diff --git a/src/main.ts b/src/main.ts index 08060b8d..64d1539b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,7 +9,7 @@ import { loadFonts } from '@/plugins/vuetify/webfontloader'; import '@/plugins/vuetify/@core/scss/template/index.scss'; import '@/plugins/vuetify/styles/styles.scss'; import '@/style.css'; -import { createApp } from 'vue'; +import { createApp, ref } from 'vue'; import { createPinia } from 'pinia'; import LazyLoad from 'lazy-load-vue3'; // import router from "@/plugins/vuetify/router"; @@ -32,4 +32,10 @@ app.mount('#app'); // fetch latest block every 6s const blockStore = useBaseStore() -setInterval(() => {blockStore.fetchLatest()}, 6000) +const requestCounter = ref(0) +setInterval(() => { + requestCounter.value += 1 + if(requestCounter.value < 5) { // max allowed request + blockStore.fetchLatest().finally(() => requestCounter.value -= 1) + } +}, 6000) diff --git a/src/modules/[chain]/block/index.vue b/src/modules/[chain]/block/index.vue index 6bfeac4c..da1eea1d 100644 --- a/src/modules/[chain]/block/index.vue +++ b/src/modules/[chain]/block/index.vue @@ -10,7 +10,9 @@ const base = useBaseStore() const format = useFormatter(); const list = computed(() => { - return base.recents.reverse() + // const recents = base.recents + // return recents.sort((a, b) => (Number(b.block.header.height) - Number(a.block.header.height))) + return base.recents })