diff --git a/src/layouts/components/ChainProfile.vue b/src/layouts/components/ChainProfile.vue index 0b88819c..b1049d80 100644 --- a/src/layouts/components/ChainProfile.vue +++ b/src/layouts/components/ChainProfile.vue @@ -86,8 +86,8 @@ chainStore.$subscribe((m, s) => {
- {{ - baseStore.latest.block?.header?.chain_id || chainStore.chainName || '' + #{{ + baseStore.latest?.block?.header?.height || chainStore.chainName || '' }}
{blockStore.fetchLatest()}, 6000) +const blockStore = useBaseStore() +setInterval(() => {blockStore.fetchLatest()}, 6000) diff --git a/src/modules/[chain]/block/[height].vue b/src/modules/[chain]/block/[height].vue index a0b3a3f8..bbc8b232 100644 --- a/src/modules/[chain]/block/[height].vue +++ b/src/modules/[chain]/block/[height].vue @@ -5,19 +5,23 @@ import { useBlockModule } from './block'; import DynamicComponent from '@/components/dynamic/DynamicComponent.vue'; import { computed } from '@vue/reactivity'; import { onBeforeRouteUpdate } from 'vue-router'; +import { useBaseStore } from '@/stores'; +import { ref } from 'vue'; +import type { Block } from '@/types'; const props = defineProps(['height', 'chain']); -const store = useBlockModule(); -store.fetchBlock(props.height); +const store = useBaseStore(); const tab = ref('summary'); +const current = ref({} as Block) +store.fetchBlock(props.height).then(x => current.value = x) const height = computed(() => { - return Number(store.current.block?.header?.height || props.height || 0); + return Number(current.value.block?.header?.height || props.height || 0); }); onBeforeRouteUpdate(async (to, from, next) => { if (from.path !== to.path) { - store.fetchBlock(String(to.params.height)); + store.fetchBlock(String(to.params.height)).then(x => current.value = x); next(); } }); @@ -26,7 +30,7 @@ onBeforeRouteUpdate(async (to, from, next) => {

-

#{{ store.current.block?.header?.height }}

+

#{{ current.block?.header?.height }}

{

- +

Block Header

- +

Transactions

- +

Last Commit

- +
diff --git a/src/modules/[chain]/block/index.vue b/src/modules/[chain]/block/index.vue index 78c0f946..6c952852 100644 --- a/src/modules/[chain]/block/index.vue +++ b/src/modules/[chain]/block/index.vue @@ -1,13 +1,12 @@