forked from cerc-io/cosmos-explorer
add live check
This commit is contained in:
parent
3188e500f0
commit
8775298123
@ -13,6 +13,7 @@ const format = useFormatter();
|
|||||||
const latest = ref({})
|
const latest = ref({})
|
||||||
const commits = ref([] as Commit[]);
|
const commits = ref([] as Commit[]);
|
||||||
const keyword = ref("")
|
const keyword = ref("")
|
||||||
|
const live = ref(true);
|
||||||
|
|
||||||
const signingInfo = ref({})
|
const signingInfo = ref({})
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ const validators = computed(()=> {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
live.value = true
|
||||||
baseStore.fetchLatest().then(block => {
|
baseStore.fetchLatest().then(block => {
|
||||||
latest.value = block
|
latest.value = block
|
||||||
commits.value.unshift(block.block.last_commit)
|
commits.value.unshift(block.block.last_commit)
|
||||||
@ -30,11 +32,15 @@ onMounted(() => {
|
|||||||
// constructs sequence for loading blocks
|
// constructs sequence for loading blocks
|
||||||
let promise = Promise.resolve()
|
let promise = Promise.resolve()
|
||||||
for (let i = height - 1; i > height - 50; i -= 1) {
|
for (let i = height - 1; i > height - 50; i -= 1) {
|
||||||
if (i > height - 48 && i > 0) {
|
if (i > height - 48) {
|
||||||
promise = promise.then(() => new Promise(resolve => {
|
promise = promise.then(() => new Promise((resolve, reject) => {
|
||||||
baseStore.fetchBlock(i).then((x) => {
|
baseStore.fetchBlock(i).then((x) => {
|
||||||
commits.value.unshift(x.block.last_commit)
|
commits.value.unshift(x.block.last_commit)
|
||||||
resolve()
|
if(live.value) {
|
||||||
|
resolve()
|
||||||
|
} else {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
@ -49,6 +55,10 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
live.value = false
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
Reference in New Issue
Block a user