Skip to content

Commit

Permalink
check updated address
Browse files Browse the repository at this point in the history
  • Loading branch information
ebedoise committed Aug 1, 2024
1 parent ee179d5 commit 237a48f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/poll/src/Choices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const Choices = () => {
const [currentAddress, setCurrentAddress] = useState<Nullable<string>>(address ?? null);

useEffect(() => {
console.log('Address from useAccount:', address);
setCurrentAddress(address ?? null);
}, [address]);

Expand All @@ -48,15 +49,14 @@ export const Choices = () => {
if (!data || !data.poll) return <>Error</>;

const alreadyVoted = haveAlreadyVote(data.poll.voters, currentAddress ?? undefined);

const handleClickOnChoice = (choice: ChoiceType) => {
setChoice(choice);
onOpen();
};

const handleVote = async (choiceId: string) => {
console.log('alreadyVoted: ', alreadyVoted);
console.log('address: ', currentAddress);
console.log('currentAddress: ', currentAddress);
if (alreadyVoted) {
toast({
title: 'You have already voted',
Expand Down

0 comments on commit 237a48f

Please sign in to comment.