Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

[FEATURE] Update checkIfUserHasVoted to list all proposals voting state #1

Open
1 task done
mkubdev opened this issue Apr 6, 2022 · 0 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@mkubdev
Copy link
Contributor

mkubdev commented Apr 6, 2022

Detailed description

On index.js file :

  const [hasVoted, setHasVoted] = useState(false);

...

const checkIfUserHasVoted = async () => {
      try {
        // Actually it only check the first proposal, we need to check all proposals
        // and dispatch states
        const hasVoted = await vote.hasVoted(proposals[0].proposalId, address);
        setHasVoted(hasVoted);
        ...

We check only the first DAO proposals !

I suggest to update this function and the setHasVoted state logic to be able to list all proposals states.

Context

This is a requiered feature because the dapp actually set state only for the first proposal.

Possible implementation

Maybe we can make something like :

  const [hasVoted, setHasVoted] = useState([]);

...

 proposals.forEach(proposal => {
      const hasVoted = await vote.hasVoted(proposal.proposalId, address);
      setHasVoted( ... );
})

Additional information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mkubdev mkubdev added the enhancement New feature or request label Apr 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant