Skip to content

Commit

Permalink
fix: handle key not found
Browse files Browse the repository at this point in the history
  • Loading branch information
donnyquixotic committed Feb 8, 2024
1 parent 7f822e0 commit c12ee41
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pages/Block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default defineComponent({
<q-card class="info-card" flat>
<div class="q-pa-md-md q-pa-sm-sm q-pa-xs-xs q-pa-xl-lg">
<q-card-section class="q-pl-md">
<div class="text-h4 text-bold">Block not found.</div>
<div class="text-h4 text-bold">block not found</div>
</q-card-section>
</div>
</q-card>
Expand Down
22 changes: 19 additions & 3 deletions src/pages/Key.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ export default defineComponent({
name: 'Key',
setup() {
const route = useRoute();
const pubKey = ref<PublicKey>(PublicKey.from(route.params.key as string));
const pubKey = ref<PublicKey>();
const accounts = ref<Name[]>([]);
onMounted(async () => {
accounts.value = (await api.getKeyAccounts(pubKey.value)).account_names;
try{
pubKey.value = PublicKey.from(route.params.key as string);
accounts.value = (await api.getKeyAccounts(pubKey.value)).account_names;
}catch(e){
console.error(e);
}
});
return {
pubKey,
Expand All @@ -27,7 +32,18 @@ export default defineComponent({
</script>

<template>
<KeyAccountsCard :pubKey="pubKey" :accounts="accounts" />
<KeyAccountsCard v-if="pubKey" :pubKey="pubKey" :accounts="accounts" />
<div v-else class="q-pa-lg">
<div class="row justify-center">
<q-card class="info-card" flat>
<div class="q-pa-md-md q-pa-sm-sm q-pa-xs-xs q-pa-xl-lg">
<q-card-section class="q-pl-sm">
<div class="text-h4 text-bold">key not found</div>
</q-card-section>
</div>
</q-card>
</div>
</div>
</template>

<style scoped lang="sass">
Expand Down
2 changes: 1 addition & 1 deletion src/pages/TransactionPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default defineComponent({
<q-card class="info-card" flat>
<div class="q-pa-md-md q-pa-sm-sm q-pa-xs-xs q-pa-xl-lg">
<q-card-section class="q-pl-md">
<div class="text-h4 text-bold">Transaction not found.</div>
<div class="text-h4 text-bold">transaction not found</div>
</q-card-section>
</div>
</q-card>
Expand Down

0 comments on commit c12ee41

Please sign in to comment.