paideiadao / paideia-app

paideia-app.vercel.app
MIT License
5 stars 6 forks source link

Need a way to show users how they've already voted #54

Closed esot321c closed 10 months ago

esot321c commented 11 months ago

When a user votes on a proposal, the votes are correctly logged, but the user can't see how they voted. There's not even an indication that they did already vote

esot321c commented 11 months ago
image

Include number of votes that you voted with?

Luivatra commented 11 months ago

API endpoint /proposals/{proposal_slug}/votes

Example: https://api.paideia.im/beta/proposals/hello-chained-transactions-7776e237-528f-4663-851e-14826af0748e/votes

Response:

[
  {
    "stake_key": "bc1390bb526a741f1c9ad1526fa05c2c3bce353fb517cef91fa9b25088f86c92",
    "vote": [
      0,
      45577403
    ]
  },
  {
    "stake_key": "c3596bc7136b6b3eab9c2f7302316211f02d8e97c294f6f134156ff72572b69e",
    "vote": [
      0,
      4478314990
    ]
  }
]

Find the stake key belonging to the current user and show the existing vote. vote is an array of vote power used, with index 0 = "No" and index 1 = "Yes"