fix duplicated load

This commit is contained in:
liangping 2023-02-07 20:47:54 +08:00
parent 7683cca288
commit 5dab0d6adf

View File

@ -117,7 +117,7 @@
<span class="font-weight-bolder"> <span class="font-weight-bolder">
{{ item.wallet }} {{ item.wallet }}
<b-badge <b-badge
v-for="(name, i) in names[item.address.addr]" v-for="(name, i) in domains[item.address.addr]"
:key="i" :key="i"
v-b-tooltip.hover.top="name.provider" v-b-tooltip.hover.top="name.provider"
variant="primary" variant="primary"
@ -243,9 +243,13 @@ export default {
index: 0, index: 0,
chainid: '', chainid: '',
names: {}, names: {},
loading: [],
} }
}, },
computed: { computed: {
domains() {
return this.names
},
walletName() { walletName() {
const key = this.$store?.state?.chains?.defaultWallet const key = this.$store?.state?.chains?.defaultWallet
return key || 'Wallet' return key || 'Wallet'
@ -286,30 +290,33 @@ export default {
}, },
methods: { methods: {
formatAddr(v) { formatAddr(v) {
this.$http.resolveStarName(v).then(res => { if (!this.loading.includes(v)) {
const name = { this.loading.push(v)
name: res.data, this.$http.resolveStarName(v).then(res => {
provider: 'Stargaze',
}
if (this.names[v]) {
this.names[v].push(name)
} else {
this.names[v] = [name]
}
})
resolvePrimaryDomainByAddress(this.address).then(result => {
if (result.isOk()) {
const name = { const name = {
name: result.value, name: res.data,
provider: 'IBC Domain', provider: 'Stargaze',
} }
if (this.names[v]) { if (this.names[v]) {
this.names[v].push(name) this.names[v].push(name)
} else { } else {
this.names[v] = [name] this.names[v] = [name]
} }
} })
}) resolvePrimaryDomainByAddress(this.address).then(result => {
if (result.isOk()) {
const name = {
name: result.value,
provider: 'IBC Domain',
}
if (this.names[v]) {
this.names[v].push(name)
} else {
this.names[v] = [name]
}
}
})
}
return v.substring(0, 10).concat('...', v.substring(v.length - 10)) return v.substring(0, 10).concat('...', v.substring(v.length - 10))
}, },
updateDefaultWallet(v) { updateDefaultWallet(v) {