diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue index 11f327aff..02a9e220a 100644 --- a/src/views/ContactAmountsView.vue +++ b/src/views/ContactAmountsView.vue @@ -142,11 +142,21 @@ export default class ContactsView extends Vue { giveRecords: Array = []; alertTitle = ""; alertMessage = ""; + accounts: AccountsSchema; + numAccounts = 0; + + async beforeCreate() { + accountsDB.open(); + this.accounts = accountsDB.accounts; + this.numAccounts = await this.accounts.count(); + } public async getIdentity(activeDid) { await accountsDB.open(); - const accounts = await accountsDB.accounts.toArray(); - const account = R.find((acc) => acc.did === activeDid, accounts); + const account = await accountsDB.accounts + .where("did") + .equals(activeDid) + .first(); const identity = JSON.parse(account?.identity || "null"); if (!identity) { diff --git a/src/views/ContactsView.vue b/src/views/ContactsView.vue index fb8144175..21f352f57 100644 --- a/src/views/ContactsView.vue +++ b/src/views/ContactsView.vue @@ -578,7 +578,7 @@ export default class ContactsView extends Vue { } async onClickAddGive(fromDid: string, toDid: string): Promise { - const identity = this.getIdentity(this.activeDid); + const identity = await this.getIdentity(this.activeDid); // if they have unconfirmed amounts, ask to confirm those first if (toDid == identity?.did && this.givenToMeUnconfirmed[fromDid] > 0) { diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index a289f7cd8..336433ebf 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -71,7 +71,6 @@