Do not allow to vote without selecting an answer
This commit is contained in:
parent
b1ef502e95
commit
2634f8ff91
|
@ -55,12 +55,12 @@ export function Poll({ poll, wakuPolling, theme, account }: PollProps) {
|
||||||
</PollAnswersWrapper>
|
</PollAnswersWrapper>
|
||||||
{userInVoters < 0 && (
|
{userInVoters < 0 && (
|
||||||
<SmallButton
|
<SmallButton
|
||||||
disabled={!account}
|
disabled={!account || selectedAnswer === undefined}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (wakuPolling && account) {
|
if (wakuPolling && account && selectedAnswer !== undefined) {
|
||||||
const result = await wakuPolling.sendTimedPollVote(
|
const result = await wakuPolling.sendTimedPollVote(
|
||||||
poll.poll.id,
|
poll.poll.id,
|
||||||
selectedAnswer ?? 0,
|
selectedAnswer,
|
||||||
poll.poll.pollType === PollType.WEIGHTED ? BigNumber.from(tokenAmount) : undefined
|
poll.poll.pollType === PollType.WEIGHTED ? BigNumber.from(tokenAmount) : undefined
|
||||||
)
|
)
|
||||||
if (result === 1) {
|
if (result === 1) {
|
||||||
|
|
Loading…
Reference in New Issue