forked from LaconicNetwork/cosmos-explorer
refactor version compatible support
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { BaseRestClient } from '@/libs/client';
|
||||
import { adapter, type AbstractRegistry, type Request } from '@/libs/registry';
|
||||
import { adapter, type AbstractRegistry, type Request } from '@/libs/api/registry';
|
||||
import { defineStore } from 'pinia';
|
||||
import type {
|
||||
CodeInfo,
|
||||
|
||||
@@ -32,7 +32,7 @@ const stakingStore = useStakingStore();
|
||||
const chainStore = useBlockchain();
|
||||
|
||||
store.fetchProposal(props.proposal_id).then((res) => {
|
||||
const proposalDetail = reactive(res.proposal);
|
||||
let proposalDetail = reactive(res.proposal);
|
||||
// when status under the voting, final_tally_result are no data, should request fetchTally
|
||||
if (res.proposal?.status === 'PROPOSAL_STATUS_VOTING_PERIOD') {
|
||||
store.fetchTally(props.proposal_id).then((tallRes) => {
|
||||
@@ -55,7 +55,7 @@ store.fetchProposal(props.proposal_id).then((res) => {
|
||||
})
|
||||
}
|
||||
|
||||
const msgType = proposalDetail.content['@type'] || '';
|
||||
const msgType = proposalDetail.content?.['@type'] || '';
|
||||
if(msgType.endsWith('MsgUpdateParams')) {
|
||||
if(msgType.indexOf('staking') > -1) {
|
||||
chainStore.rpc.getStakingParams().then((res) => {
|
||||
@@ -214,7 +214,12 @@ function pageload(p: number) {
|
||||
}
|
||||
|
||||
function metaItem(metadata: string|undefined): { title: string; summary: string } {
|
||||
return metadata ? JSON.parse(metadata) : {}
|
||||
if (!metadata) {
|
||||
return { title: '', summary: '' }
|
||||
} else if (metadata.startsWith('{') && metadata.endsWith('}')) {
|
||||
return JSON.parse(metadata)
|
||||
}
|
||||
return { title: metadata, summary: '' }
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user