consolidate getIdentity & remove dups

This commit is contained in:
2024-07-11 19:43:56 -06:00
parent 7cb9e2aa52
commit 11163dfad9
8 changed files with 12 additions and 133 deletions

View File

@@ -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<GiveSummaryRecord> = [];
const url =
this.apiServer +