Do not allow to vote without selecting an answer

This commit is contained in:
Franck 2021-12-22 15:50:22 +11:00
parent b1ef502e95
commit 2634f8ff91
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 3 additions and 3 deletions

View File

@ -55,12 +55,12 @@ export function Poll({ poll, wakuPolling, theme, account }: PollProps) {
</PollAnswersWrapper>
{userInVoters < 0 && (
<SmallButton
disabled={!account}
disabled={!account || selectedAnswer === undefined}
onClick={async () => {
if (wakuPolling && account) {
if (wakuPolling && account && selectedAnswer !== undefined) {
const result = await wakuPolling.sendTimedPollVote(
poll.poll.id,
selectedAnswer ?? 0,
selectedAnswer,
poll.poll.pollType === PollType.WEIGHTED ? BigNumber.from(tokenAmount) : undefined
)
if (result === 1) {