update tally for ongoing proposals

This commit is contained in:
liangping 2022-11-01 20:16:33 +08:00
parent b5183e7214
commit 30e8a354bc
2 changed files with 11 additions and 7 deletions

View File

@ -80,12 +80,14 @@ export default {
}) })
}, },
updateTally(res) { updateTally(res) {
const voting = res.filter(i => i.status === 2) this.$http.getStakingPool().then(pool => {
if (voting.length > 0) { const voting = res.filter(i => i.status === 2)
voting.forEach(p => this.$http.getGovernanceTally(p.id, 0).then(update => { if (voting.length > 0) {
this.$set(p, 'tally', update) voting.forEach(p => this.$http.getGovernanceTally(p.id, pool.bondedToken).then(update => {
})) this.$set(p, 'tally', update)
} }))
}
})
}, },
}, },
} }

View File

@ -367,7 +367,9 @@ export default {
this.$http.getGovernance(pid).then(p => { this.$http.getGovernance(pid).then(p => {
if (p.status === 2) { if (p.status === 2) {
this.$http.getGovernanceTally(pid, 0).then(t => p.updateTally(t)) this.$http.getStakingPool().then(pool => {
this.$http.getGovernanceTally(pid, pool.bondedToken).then(t => p.updateTally(t))
})
} }
this.proposal = p this.proposal = p
}) })