Cancel fetch up on destroy
This commit is contained in:
parent
ec23ca0ebd
commit
364b268b02
@ -164,11 +164,9 @@ export default {
|
|||||||
console.log(identities)
|
console.log(identities)
|
||||||
let promise = Promise.resolve()
|
let promise = Promise.resolve()
|
||||||
identities.forEach(item => {
|
identities.forEach(item => {
|
||||||
if (this.islive) {
|
promise = promise.then(() => new Promise(resolve => {
|
||||||
promise = promise.then(() => new Promise(resolve => {
|
this.avatar(item, resolve)
|
||||||
this.avatar(item, resolve)
|
}))
|
||||||
}))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -201,19 +199,21 @@ export default {
|
|||||||
return 'primary'
|
return 'primary'
|
||||||
},
|
},
|
||||||
avatar(identity, resolve) {
|
avatar(identity, resolve) {
|
||||||
keybase(identity).then(d => {
|
if (this.islive) {
|
||||||
resolve()
|
keybase(identity).then(d => {
|
||||||
console.log(identity)
|
resolve()
|
||||||
if (Array.isArray(d.them) && d.them.length > 0) {
|
console.log(identity)
|
||||||
const pic = d.them[0].pictures
|
if (Array.isArray(d.them) && d.them.length > 0) {
|
||||||
console.log('fetch new avatar:', pic)
|
const pic = d.them[0].pictures
|
||||||
if (pic) {
|
console.log('fetch new avatar:', pic)
|
||||||
const validator = this.validators.find(u => u.description.identity === identity)
|
if (pic) {
|
||||||
this.$set(validator, 'avatar', pic.primary.url)
|
const validator = this.validators.find(u => u.description.identity === identity)
|
||||||
this.$store.commit('cacheAvatar', { identity, url: pic.primary.url })
|
this.$set(validator, 'avatar', pic.primary.url)
|
||||||
|
this.$store.commit('cacheAvatar', { identity, url: pic.primary.url })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user