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

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

@mkubdev

Description

@mkubdev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions