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

@@ -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