From 9342e22c9e9ff5707522ba37dc895646cf058b9f Mon Sep 17 00:00:00 2001 From: ebedoise Date: Thu, 1 Aug 2024 14:47:40 +0200 Subject: [PATCH] check log alreadyVoted in polls --- apps/poll/src/Choices.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/poll/src/Choices.tsx b/apps/poll/src/Choices.tsx index c53e3df2..f6bdaa31 100644 --- a/apps/poll/src/Choices.tsx +++ b/apps/poll/src/Choices.tsx @@ -50,6 +50,7 @@ export const Choices = () => { const handleVote = async (choiceId: string) => { console.log('alreadyVoted: ', alreadyVoted); + console.log('address: ', address); if (alreadyVoted) { toast({ title: 'You have already voted', @@ -59,6 +60,15 @@ export const Choices = () => { return; } + if (!address) { + toast({ + title: 'Connect your wallet to vote', + status: 'warning', + duration: 2000, + }); + return; + } + await vote({ variables: { choiceId, pollId: id, voters: [address] }, update: updateCacheAfterVote,