From e25a83ff1bc29b5689fb4411bfc06f3b01ba3059 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Sat, 8 Jul 2023 17:19:52 +0800 Subject: [PATCH] Move account counter to mounted event --- src/views/AccountViewView.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/views/AccountViewView.vue b/src/views/AccountViewView.vue index be4603c7..ef6f01dc 100644 --- a/src/views/AccountViewView.vue +++ b/src/views/AccountViewView.vue @@ -315,6 +315,7 @@ export default class AccountViewView extends Vue { limitsMessage = ""; loadingLimits = true; // might as well now that we do it on mount, to avoid flashing the registration message showContactGives = false; + private accounts: AccountsSchema; showDidCopy = false; showDerCopy = false; @@ -361,7 +362,16 @@ export default class AccountViewView extends Vue { return timeStr.substring(0, timeStr.indexOf("T")); } - // 'created' hook runs when the Vue instance is first created + async initializeCount() { + this.numAccounts = await this.accounts.count(); + } + + async mounted() { + accountsDB.open(); + this.accounts = accountsDB.accounts; + await this.initializeCount(); + } + async created() { // Uncomment this to register this user on the test server. // To manage within the vue devtools browser extension https://devtools.vuejs.org/ @@ -380,6 +390,7 @@ export default class AccountViewView extends Vue { this.showContactGives = !!settings?.showContactGivesInline; const identity = await this.getIdentity(this.activeDid); + this.publicHex = identity.keys[0].publicKeyHex; this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64"); this.derivationPath = identity.keys[0].meta.derivationPath;