Revert "Check ForceNone (#2835)" (#2836)

This reverts commit 824bf2f61c.
This commit is contained in:
Jaco Greeff 2020-05-27 19:20:10 +02:00 committed by GitHub
parent 5369ff6b0b
commit 393b068f85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
import { DeriveStakingOverview } from '@polkadot/api-derive/types';
import { AppProps as Props } from '@polkadot/react-components/types';
import { ElectionStatus, Forcing } from '@polkadot/types/interfaces';
import { ElectionStatus } from '@polkadot/types/interfaces';
import React, { useEffect, useMemo, useReducer, useState } from 'react';
import { Route, Switch } from 'react-router';
@ -44,12 +44,9 @@ function StakingApp ({ basePath, className = '' }: Props): React.ReactElement<Pr
const ownStashes = useOwnStashInfos();
const targets = useSortedTargets();
const stakingOverview = useCall<DeriveStakingOverview>(api.derive.staking.overview, []);
const isInElection = useCall<boolean>(api.query.staking.eraElectionStatus, [], {
const isInElection = useCall<boolean>(api.query.staking?.eraElectionStatus, [], {
transform: (status: ElectionStatus) => status.isOpen
});
const isPOA = useCall<boolean>(api.query.staking.forceEra, [], {
transform: (forcing: Forcing) => forcing.isForceNone
});
const [nominators, dispatchNominators] = useReducer(reduceNominators, [] as string[]);
const hasQueries = useMemo(
(): boolean =>
@ -145,7 +142,7 @@ function StakingApp ({ basePath, className = '' }: Props): React.ReactElement<Pr
</Switch>
<Actions
className={pathname === `${basePath}/actions` ? '' : 'staking--hidden'}
isInElection={isInElection && !isPOA}
isInElection={isInElection}
next={next}
ownStashes={ownStashes}
targets={targets}