Skip to content

Commit 6a29359

Browse files
authored
Merge pull request #118 from celenium-io/dev
Hot fix ssr
2 parents 6c36d7d + 2b261e2 commit 6a29359

File tree

16 files changed

+8485
-8988
lines changed

16 files changed

+8485
-8988
lines changed

components/data/LatestPFBTable.vue

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,16 @@ import { useServerURL } from "@/services/config"
1313
import { comma, space, splitAddress, tia } from "@/services/utils"
1414
1515
/** API */
16-
// import { fetchLatestPFBs } from "@/services/api/tx"
16+
import { fetchLatestPFBs } from "@/services/api/tx"
1717
1818
const router = useRouter()
1919
2020
const isLoading = ref(true)
2121
const pfbs = ref([])
2222
23-
const fetchLatestPFBs = async (height) => {
24-
try {
25-
return await $fetch(`${useServerURL()}/tx?msg_type=MsgPayForBlobs&sort=desc&limit=5`)
26-
} catch (error) {
27-
console.error(error)
28-
}
29-
}
30-
31-
// pfbs.value = await fetchLatestPFBs()
32-
// pfbs.value = data.value
33-
34-
onBeforeMount(async() => {
35-
isLoading.value = true
36-
37-
pfbs.value = await fetchLatestPFBs()
38-
39-
isLoading.value = false
40-
})
23+
const { data } = await fetchLatestPFBs()
24+
pfbs.value = data.value
25+
isLoading.value = false
4126
4227
</script>
4328

components/data/RecentNamespacesTable.vue

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { useServerURL } from "@/services/config"
1212
import { comma, space, formatBytes, getNamespaceID } from "@/services/utils"
1313
1414
/** API */
15-
// import { fetchNamespaces } from "@/services/api/namespace"
15+
import { fetchNamespaces } from "@/services/api/namespace"
1616
1717
const router = useRouter()
1818
@@ -24,36 +24,16 @@ const sort = reactive({
2424
dir: "desc",
2525
})
2626
27-
const fetchNamespaces = async ({ limit, offset, sort, sort_by }) => {
28-
try {
29-
const url = new URL(`${useServerURL()}/namespace`)
30-
31-
if (limit) url.searchParams.append("limit", limit)
32-
if (offset) url.searchParams.append("offset", offset)
33-
if (sort) url.searchParams.append("sort", sort)
34-
if (sort_by) url.searchParams.append("sort_by", sort_by)
35-
36-
37-
return await $fetch(url.href)
38-
} catch (error) {
39-
console.error(error)
40-
}
41-
}
42-
4327
const getNamespaces = async () => {
4428
isLoading.value = true
4529
46-
namespaces.value = await fetchNamespaces({ limit: 5, sort: sort.dir, sort_by: sort.by })
47-
// namespaces.value = data.value
30+
const { data } = await fetchNamespaces({ limit: 5, sort: sort.dir, sort_by: sort.by })
31+
namespaces.value = data.value
4832
4933
isLoading.value = false
5034
}
5135
52-
// await getNamespaces()
53-
54-
onBeforeMount(async() => {
55-
await getNamespaces()
56-
})
36+
await getNamespaces()
5737
5838
const handleSort = async (by) => {
5939
switch (sort.dir) {

components/widgets/StakingWidget.vue

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useServerURL } from "@/services/config"
77
import { abbreviate, capitilize, numToPercent, shareOfTotal } from "@/services/utils"
88
99
/** API */
10-
// import { fetchValidatorsCount } from "@/services/api/validator"
10+
import { fetchValidatorsCount } from "@/services/api/validator"
1111
1212
/** Store */
1313
import { useAppStore } from "@/store/app"
@@ -27,7 +27,7 @@ const totalVotingPowerUSD = computed(() => totalVotingPower.value * currentPrice
2727
2828
const bondedShare = computed(() => shareOfTotal(lastHead?.value.total_voting_power * 1_000_000, lastHead?.value.total_supply, 2))
2929
30-
const isRefetching = ref(false)
30+
const isRefetching = ref(true)
3131
const totalValidators = ref(0)
3232
const activeValidators = ref(0)
3333
const validatorsGraph = ref([
@@ -51,26 +51,16 @@ const validatorsGraph = ref([
5151
},
5252
])
5353
54-
const fetchValidatorsCount = async () => {
55-
try {
56-
const url = new URL(`${useServerURL()}/validators/count`)
57-
58-
return await $fetch(url.href)
59-
} catch (error) {
60-
console.error(error)
61-
}
62-
}
63-
6454
const getValidatorsStats = async () => {
6555
isRefetching.value = true
6656
67-
const data = await fetchValidatorsCount()
68-
if (data?.total) {
69-
totalValidators.value = data.total
70-
activeValidators.value = data.active
57+
const { data } = await fetchValidatorsCount()
58+
if (data.value?.total) {
59+
totalValidators.value = data.value.total
60+
activeValidators.value = data.value.active
7161
7262
for (let item of validatorsGraph.value) {
73-
let value = data[item.title]
63+
let value = data.value[item.title]
7464
7565
if (value) {
7666
item.count = value
@@ -82,11 +72,7 @@ const getValidatorsStats = async () => {
8272
isRefetching.value = false
8373
}
8474
85-
// await getValidatorsStats()
86-
87-
onBeforeMount(async() => {
88-
await getValidatorsStats()
89-
})
75+
await getValidatorsStats()
9076
9177
onMounted( async () => {
9278
wrapperWidth.value = wrapperEl.value.wrapper.offsetWidth

nuxt.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export default defineNuxtConfig({
144144
plugins: [wasm(), topLevelAwait(), nodePolyfills()],
145145
worker: {
146146
format: "es",
147-
plugins: [wasm(), topLevelAwait()],
147+
plugins: () => [wasm(), topLevelAwait()],
148148
},
149149
},
150150
})

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"packageManager": "pnpm@8.7.4",
55
"homepage": "https://celenium.io/",
66
"license": "MIT",
7+
"type": "module",
78
"scripts": {
89
"build": "nuxt build",
910
"dev": "cross-env PORT=9090 nuxt dev",

pages/blobstream.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ const handleViewCommitment = (commitment) => {
181181
modalsStore.open("commitment")
182182
}
183183
184-
getNetworks()
185-
getCommitments()
184+
await getNetworks()
185+
await getCommitments()
186186
</script>
187187
188188
<template>

pages/index.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,18 @@ onBeforeMount(async () => {
7979
</script>
8080

8181
<template>
82-
<!-- <ClientOnly> -->
83-
<Flex direction="column" wide :class="$style.wrapper">
84-
<Widgets :class="$style.widgets" />
82+
<Flex direction="column" wide :class="$style.wrapper">
83+
<Widgets :class="$style.widgets" />
8584

86-
<Flex direction="column" gap="40" :class="$style.main">
87-
<Flex gap="20" :class="$style.small_tables">
88-
<RecentNamespacesTable />
89-
<LatestPFBTable />
90-
</Flex>
91-
92-
<BlocksTimelineTable v-if="appStore.lastHead && appStore.latestBlocks.length" />
85+
<Flex direction="column" gap="40" :class="$style.main">
86+
<Flex gap="20" :class="$style.small_tables">
87+
<RecentNamespacesTable />
88+
<LatestPFBTable />
9389
</Flex>
90+
91+
<BlocksTimelineTable v-if="appStore.lastHead && appStore.latestBlocks.length" />
9492
</Flex>
95-
<!-- </ClientOnly> -->
93+
</Flex>
9694
</template>
9795

9896
<style module>

pages/txs.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,10 @@ const getTransactions = async () => {
310310
from: filters.from,
311311
to: filters.to,
312312
})
313+
313314
transactions.value = data.value
314315
315-
handleNextCondition.value = transactions.value.length < limit.value
316+
handleNextCondition.value = transactions.value?.length < limit.value
316317
isLoaded.value = true
317318
isRefetching.value = false
318319
}
@@ -325,6 +326,10 @@ onBeforeMount(() => {
325326
}
326327
})
327328
329+
// onMounted(() => {
330+
// getTransactions()
331+
// })
332+
328333
/** Refetch transactions */
329334
watch(
330335
() => route.query,
@@ -585,7 +590,7 @@ const handleNext = () => {
585590
</Flex>
586591
587592
<Flex direction="column" gap="16" wide :class="[$style.table, isRefetching && $style.disabled]">
588-
<div v-if="transactions.length" :class="$style.table_scroller">
593+
<div v-if="transactions?.length" :class="$style.table_scroller">
589594
<table>
590595
<thead>
591596
<tr>

0 commit comments

Comments
 (0)