forked from jsnbuchanan/crowd-funder-for-time-pwa
consolidate getIdentity & remove dups
This commit is contained in:
@@ -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 +
|
||||
|
||||
Reference in New Issue
Block a user