diff --git a/src/stores/useFormatter.ts b/src/stores/useFormatter.ts
index 3c9dc00f..07f8ea59 100644
--- a/src/stores/useFormatter.ts
+++ b/src/stores/useFormatter.ts
@@ -127,7 +127,6 @@ export const useFormatter = defineStore('formatter', {
calculatePercent(input?: string|number, total?: string|number ) {
if(!input || !total) return '0'
const percent = Number(input)/Number(total)
- console.log(input, total, percent);
return numeral(percent>0.0001?percent: 0).format("0.[00]%")
},
formatDecimalToPercent(decimal: string) {
diff --git a/src/stores/useGovStore.ts b/src/stores/useGovStore.ts
index 3871febb..75b91a09 100644
--- a/src/stores/useGovStore.ts
+++ b/src/stores/useGovStore.ts
@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
import { useBlockchain } from "./useBlockchain";
import type { PageRequest, PaginatedProposals } from "@/types";
import { LoadingStatus } from "./useDashboard";
+import {reactive} from 'vue'
export const useGovStore = defineStore('govStore', {
state: () => {
@@ -27,18 +28,16 @@ export const useGovStore = defineStore('govStore', {
async fetchProposals( status: string, pagination?: PageRequest ) {
if(!this.loading[status]) {
this.loading[status] = LoadingStatus.Loading
- const proposals = await this.blockchain.rpc.getGovProposals(status)
+ const proposals = reactive(await this.blockchain.rpc.getGovProposals(status))
+ if(status === '2') {
+ proposals.proposals.forEach(async(x1) => {
+ await this.fetchTally(x1.proposal_id).then(res => {
+ x1.final_tally_result = res?.tally
+ })
+ })
+ }
this.loading[status] = LoadingStatus.Loaded
this.proposals[status] = proposals
-
- if(status === '2') {
- proposals.proposals.forEach(x1 => {
- this.fetchTally(x1.proposal_id).then(t => {
- x1.final_tally_result = t.tally
- this.proposals[status] = proposals
- })
- })
- }
}
return this.proposals[status]
},
@@ -48,7 +47,7 @@ export const useGovStore = defineStore('govStore', {
// })
},
async fetchTally(proposalId: string) {
- return this.blockchain.rpc.getGovProposalTally(proposalId)
+ return await this.blockchain.rpc.getGovProposalTally(proposalId)
},
async fetchProposal(proposalId: string) {
return this.blockchain.rpc.getGovProposal(proposalId)
@@ -59,5 +58,6 @@ export const useGovStore = defineStore('govStore', {
async fetchProposalVotes(proposalId: string, next_key?: string) {
return this.blockchain.rpc.getGovProposalVotes(proposalId, next_key)
}
- }
+ },
+
})