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) {
this.$http.getStakingPool().then(pool => {
const voting = res.filter(i => i.status === 2)
if (voting.length > 0) {
voting.forEach(p => this.$http.getGovernanceTally(p.id, 0).then(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 => {
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
})