clean code

This commit is contained in:
liangping
2021-08-05 20:53:01 +08:00
parent 2293446c93
commit 79b4bc671b
9 changed files with 6 additions and 19 deletions
+1 -3
View File
@@ -78,13 +78,11 @@ export default {
const tx = Tx.create(origin)
tx.setHash(txs[i])
array.push(tx)
console.log('tx', origin, tx)
} catch (e) {
console.log(e)
console.error(e)
}
}
if (array.length > 0) this.txs = array
console.log(this.txs)
})
},
}
+1 -1
View File
@@ -92,7 +92,7 @@ export default {
for (let i = 1; i < 20; i += 1) {
list.push(height - i)
}
console.log(height, list)
let promise = Promise.resolve()
list.forEach(item => {
promise = promise.then(() => new Promise(resolve => {
+1 -1
View File
@@ -139,7 +139,7 @@ export default {
Object.keys(this.chains).forEach(k => {
const chain = this.chains[k]
fetch(`${chain.api}/blocks/latest`).then(res => res.json()).then(b => {
console.log(b.block.header)
// console.log(b.block.header)
const { header } = b.block
this.$set(chain, 'height', header.height)
this.$set(chain, 'time', toDay(header.time))
+1 -1
View File
@@ -265,7 +265,7 @@ export default {
this.$http.getGovernance(pid).then(p => {
if (p.status === 2) {
this.$http.getGovernanceTally(pid, 0).then(t => p.updateTally(t)).catch(e => console.log('failed on update voting tally:', e))
this.$http.getGovernanceTally(pid, 0).then(t => p.updateTally(t)).catch(e => console.error('failed on update voting tally:', e))
}
this.proposal = p
})
-4
View File
@@ -161,7 +161,6 @@ export default {
this.validators = temp
// fetch avatar from keybase
console.log(identities)
let promise = Promise.resolve()
identities.forEach(item => {
promise = promise.then(() => new Promise(resolve => {
@@ -171,7 +170,6 @@ export default {
})
},
beforeDestroy() {
console.log('destroying')
this.islive = false
},
methods: {
@@ -202,10 +200,8 @@ export default {
if (this.islive) {
keybase(identity).then(d => {
resolve()
console.log(identity)
if (Array.isArray(d.them) && d.them.length > 0) {
const pic = d.them[0].pictures
console.log('fetch new avatar:', pic)
if (pic) {
const validator = this.validators.find(u => u.description.identity === identity)
this.$set(validator, 'avatar', pic.primary.url)
-2
View File
@@ -329,7 +329,6 @@ export default {
this.initBlocks()
},
beforeDestroy() {
console.log('destroying')
clearInterval(this.timer)
},
methods: {
@@ -343,7 +342,6 @@ export default {
this.accountAddress = operatorAddressToAccount(operAddress)
this.hexAddress = consensusPubkeyToHexAddress(consensusPubkey)
this.$http.getStakingDelegatorDelegation(this.accountAddress, operAddress).then(d => {
console.log(d)
this.selfDelegation = d
})
},
-1
View File
@@ -106,7 +106,6 @@ export default {
created() {
const { hash } = this.$route.params
this.$http.getTxs(hash).then(res => {
console.log(res)
this.tx = res
})
},