Skip to content

Commit

Permalink
Voting: don't query vote status when there's no connected account
Browse files Browse the repository at this point in the history
  • Loading branch information
sohkai committed Sep 2, 2019
1 parent 8f33cef commit a7fb963
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/voting/app/src/script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Aragon, { events } from '@aragon/api'
import { addressesEqual } from './web3-utils'
import voteSettings from './vote-settings'
import { VOTE_ABSENT } from './vote-types'
import { voteTypeFromContractEnum } from './vote-utils'
import { EMPTY_CALLSCRIPT } from './evmscript-utils'
import tokenDecimalsAbi from './abi/token-decimals.json'
Expand Down Expand Up @@ -227,6 +228,13 @@ async function getAccountVotes({ connectedAccount, votes = [] }) {
}

async function getVoterState({ connectedAccount, voteId }) {
if (!connectedAccount) {
return {
voteId,
voteType: VOTE_ABSENT,
}
}

// Wrap with retry in case the vote is somehow not present
return retryEvery(() =>
app
Expand Down

0 comments on commit a7fb963

Please sign in to comment.