From 2634f8ff91882854f2510433c3a8c8bb19e63d23 Mon Sep 17 00:00:00 2001 From: Franck Date: Wed, 22 Dec 2021 15:50:22 +1100 Subject: [PATCH] Do not allow to vote without selecting an answer --- packages/poll-react-components/src/components/Poll.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/poll-react-components/src/components/Poll.tsx b/packages/poll-react-components/src/components/Poll.tsx index 3ad6c79..272c7d0 100644 --- a/packages/poll-react-components/src/components/Poll.tsx +++ b/packages/poll-react-components/src/components/Poll.tsx @@ -55,12 +55,12 @@ export function Poll({ poll, wakuPolling, theme, account }: PollProps) { {userInVoters < 0 && ( { - 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) {