add error counter
This commit is contained in:
parent
4864ccf37f
commit
d37cf6fef0
@ -106,6 +106,7 @@ export default {
|
|||||||
isLoading: true,
|
isLoading: true,
|
||||||
succeed: false,
|
succeed: false,
|
||||||
error: '',
|
error: '',
|
||||||
|
checkTimes: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -133,15 +134,20 @@ export default {
|
|||||||
if (this.hash) {
|
if (this.hash) {
|
||||||
this.error = null
|
this.error = null
|
||||||
this.$http.getTxs(this.hash).then(res => {
|
this.$http.getTxs(this.hash).then(res => {
|
||||||
console.log('tx', res)
|
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
this.succeed = true
|
this.succeed = true
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
} else if (res.code !== 3) { // code 3 is tx unconfirmed(not founded).
|
} else if (res.code !== 3) { // code 3 is tx unconfirmed(not founded).
|
||||||
this.error = res.raw_log
|
this.error = res.raw_log
|
||||||
console.log('error:', this.error)
|
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
}
|
}
|
||||||
|
}, () => {
|
||||||
|
// error statement
|
||||||
|
this.checkTimes += 1
|
||||||
|
if (this.checkTimes > 5) {
|
||||||
|
clearInterval(this.timer)
|
||||||
|
this.error = 'Timeout'
|
||||||
|
}
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
this.error = e
|
this.error = e
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
|
Loading…
Reference in New Issue
Block a user