forked from jsnbuchanan/crowd-funder-for-time-pwa
consolidate getIdentity & remove dups
This commit is contained in:
@@ -281,7 +281,7 @@ export default class ProjectsView extends Vue {
|
||||
console.error("No accounts found.");
|
||||
this.errNote("You need an identifier to load your projects.");
|
||||
} else {
|
||||
this.currentIid = await this.getIdentity(activeDid);
|
||||
this.currentIid = await libsUtil.getIdentity(activeDid);
|
||||
await this.loadOffers();
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -360,22 +360,6 @@ export default class ProjectsView extends Vue {
|
||||
await this.projectDataLoader(url, token);
|
||||
}
|
||||
|
||||
public async getIdentity(activeDid: string): Promise<IIdentifier> {
|
||||
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 project records with no identifier available.",
|
||||
);
|
||||
}
|
||||
return identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle clicking on a project entry found in the list
|
||||
* @param id of the project
|
||||
|
||||
Reference in New Issue
Block a user