From 4797e32d6267ad8987f9812aed328097aeac2e98 Mon Sep 17 00:00:00 2001 From: Wan <495709+wa0x6e@users.noreply.github.com> Date: Sat, 6 Apr 2024 19:51:08 +0400 Subject: [PATCH] fix: show error when failed to load delegates list (#4655) * fix: show error when failed to load delegates list * chore: better variable name --------- Co-authored-by: Chaitanya --- src/views/DelegateView.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/views/DelegateView.vue b/src/views/DelegateView.vue index 9f1b1a5a7178..fbbcf9dae061 100644 --- a/src/views/DelegateView.vue +++ b/src/views/DelegateView.vue @@ -32,6 +32,7 @@ const form = ref({ address: (route.params.to as string) || '', id: (route.params.key as string) || '' }); +const delegationLoadingError = ref(false); const { profiles, loadProfiles } = useProfiles(); @@ -97,6 +98,7 @@ const getDelegationsAndDelegatesLoading = ref(false); async function getDelegationsAndDelegates() { if (web3Account.value) { try { + delegationLoadingError.value = false; getDelegationsAndDelegatesLoading.value = true; const [delegatesObj, delegatorsObj] = await Promise.all([ getDelegates(networkKey.value, web3Account.value), @@ -108,6 +110,7 @@ async function getDelegationsAndDelegates() { delegates.value = []; delegators.value = []; console.log(error); + delegationLoadingError.value = true; } finally { getDelegationsAndDelegatesLoading.value = false; } @@ -124,6 +127,7 @@ async function getDelegatesWithScore() { ); if (delegationStrategy.length === 0) return; + delegationLoadingError.value = false; delegatesLoading.value = true; try { const delegations: any = await getDelegatesBySpace( @@ -166,6 +170,7 @@ async function getDelegatesWithScore() { delegatesLoading.value = false; } catch (e) { delegatesLoading.value = false; + delegationLoadingError.value = true; console.log(e); return e; } @@ -327,7 +332,6 @@ onMounted(async () => { /> - { " /> + +
+ Error while retrieving the + delegates list +
{{ $tc('delegate.noDelegatesFoundFor', [space.id]) }}