From 2ae72cb2275bb5307184ea285c392f0861a09f6b Mon Sep 17 00:00:00 2001 From: Viterbo Date: Mon, 18 Nov 2024 12:28:55 -0300 Subject: [PATCH] adding "no transactions yet" case for address which does not have any history trx --- src/components/AddressMoreInfo.vue | 18 +++++++++++++----- src/i18n/de-de/index.js | 1 + src/i18n/en-us/index.js | 1 + src/i18n/es-es/index.js | 1 + src/i18n/fr-fr/index.js | 1 + src/i18n/pt-br/index.js | 1 + src/pages/AccountPage.vue | 12 ------------ 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/components/AddressMoreInfo.vue b/src/components/AddressMoreInfo.vue index a3d42d22..29899b09 100644 --- a/src/components/AddressMoreInfo.vue +++ b/src/components/AddressMoreInfo.vue @@ -10,6 +10,7 @@ const { t: $t } = useI18n(); const lastTxn = ref('...'); const firstTxn = ref('...'); +const noTrxYet = ref(false); const loadingComplete = ref(false); const props = defineProps({ @@ -24,11 +25,13 @@ onBeforeMount(async () => { const lastTxnQuery = (await indexerApi.get(`address/${props.address}/transactions?limit=1&includePagination=true`) as TransactionQueryData).data; if (lastTxnQuery.results.length){ lastTxn.value = lastTxnQuery.results[0].hash; + // use total count to offset query and fetch first transaction + const offset = lastTxnQuery.total_count - 1; + const firstTxnQuery = (await indexerApi.get(`address/${props.address}/transactions?limit=1&offset=${offset}`) as TransactionQueryData).data; + firstTxn.value = firstTxnQuery.results[0].hash; + } else { + noTrxYet.value = true; } - // use total count to offset query and fetch first transaction - const offset = lastTxnQuery.total_count - 1; - const firstTxnQuery = (await indexerApi.get(`address/${props.address}/transactions?limit=1&offset=${offset}`) as TransactionQueryData).data; - firstTxn.value = firstTxnQuery.results[0].hash; loadingComplete.value = true; }catch(e){ console.error(e); @@ -42,6 +45,11 @@ onBeforeMount(async () => { + + +