diff --git a/src/views/ClaimAddRawView.vue b/src/views/ClaimAddRawView.vue index 9dafe3d40..4764f736d 100644 --- a/src/views/ClaimAddRawView.vue +++ b/src/views/ClaimAddRawView.vue @@ -66,20 +66,6 @@ export default class ClaimAddRawView extends Vue { } } - public async getIdentity(activeDid: string): Promise { - await accountsDB.open(); - const account = (await accountsDB.accounts - .where("did") - .equals(activeDid) - .first()) as Account; - const identity = JSON.parse(account?.identity || "null"); - - if (!identity) { - throw new Error("Cannot submit a claim without an identifier."); - } - return identity; - } - async submitClaim() { const fullClaim = JSON.parse(this.claimStr); const result = await serverUtil.createAndSubmitClaim( diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue index 2d48e6732..6c1aedf22 100644 --- a/src/views/ClaimView.vue +++ b/src/views/ClaimView.vue @@ -522,22 +522,6 @@ export default class ClaimView extends Vue { ); } - public async getIdentity(activeDid: string): Promise { - await accountsDB.open(); - const account = (await accountsDB.accounts - .where("did") - .equals(activeDid) - .first()) as Account; - const identity = JSON.parse(account?.identity || "null"); - - if (!identity) { - throw new Error( - "Attempted to load project records with no identifier available.", - ); - } - return identity; - } - // Isn't there a better way to make this available to the template? didInfo(did: string) { return serverUtil.didInfo( diff --git a/src/views/ConfirmGiftView.vue b/src/views/ConfirmGiftView.vue index 18e371e10..47143cafe 100644 --- a/src/views/ConfirmGiftView.vue +++ b/src/views/ConfirmGiftView.vue @@ -525,22 +525,6 @@ export default class ClaimView extends Vue { ); } - public async getIdentity(activeDid: string): Promise { - await accountsDB.open(); - const account = (await accountsDB.accounts - .where("did") - .equals(activeDid) - .first()) as Account; - const identity = JSON.parse(account?.identity || "null"); - - if (!identity) { - throw new Error( - "Attempted to load project records with no identifier available.", - ); - } - return identity; - } - // Isn't there a better way to make this available to the template? didInfo(did: string | undefined) { return serverUtil.didInfo( diff --git a/src/views/ContactAmountsView.vue b/src/views/ContactAmountsView.vue index 0482345d6..cefb27ce1 100644 --- a/src/views/ContactAmountsView.vue +++ b/src/views/ContactAmountsView.vue @@ -124,6 +124,7 @@ import { GiveVerifiableCredential, SCHEMA_ORG_CONTEXT, } from "@/libs/endorserServer"; +import * as libsUtil from "@/libs/util"; @Component({ components: { QuickNav } }) export default class ContactAmountssView extends Vue { @@ -142,22 +143,6 @@ export default class ContactAmountssView extends Vue { this.numAccounts = await accountsDB.accounts.count(); } - public async getIdentity(activeDid: string) { - await accountsDB.open(); - const account = await accountsDB.accounts - .where("did") - .equals(activeDid) - .first(); - const identity = JSON.parse((account?.identity as string) || "null"); - - if (!identity) { - throw new Error( - "Attempted to load Give records with no identifier available.", - ); - } - return identity; - } - async created() { try { await db.open(); @@ -190,7 +175,7 @@ export default class ContactAmountssView extends Vue { async loadGives(activeDid: string, contact: Contact) { try { - const identity = await this.getIdentity(this.activeDid); + const identity = await libsUtil.getIdentity(this.activeDid); let result: Array = []; const url = this.apiServer + diff --git a/src/views/ContactQRScanShowView.vue b/src/views/ContactQRScanShowView.vue index bf6c54844..a748f987b 100644 --- a/src/views/ContactQRScanShowView.vue +++ b/src/views/ContactQRScanShowView.vue @@ -72,7 +72,7 @@