forked from jsnbuchanan/crowd-funder-for-time-pwa
consolidate getIdentity & remove dups
This commit is contained in:
@@ -179,18 +179,18 @@ import { IIdentifier } from "@veramo/core";
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
|
||||
|
||||
import ImageMethodDialog from "@/components/ImageMethodDialog.vue";
|
||||
import QuickNav from "@/components/QuickNav.vue";
|
||||
import { DEFAULT_IMAGE_API_SERVER, NotificationIface } from "@/constants/app";
|
||||
import { accountsDB, db } from "@/db/index";
|
||||
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
|
||||
import { accessToken } from "@/libs/crypto";
|
||||
import * as libsUtil from "@/libs/util";
|
||||
import { useAppStore } from "@/store/app";
|
||||
import {
|
||||
createEndorserJwtVcFromClaim,
|
||||
PlanVerifiableCredential,
|
||||
} from "@/libs/endorserServer";
|
||||
import ImageMethodDialog from "@/components/ImageMethodDialog.vue";
|
||||
import * as libsUtil from "@/libs/util";
|
||||
import { useAppStore } from "@/store/app";
|
||||
|
||||
@Component({
|
||||
components: { ImageMethodDialog, LMap, LMarker, LTileLayer, QuickNav },
|
||||
@@ -231,22 +231,6 @@ export default class NewEditProjectView extends Vue {
|
||||
|
||||
libsUtil = libsUtil;
|
||||
|
||||
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 project records with no identifier available.",
|
||||
);
|
||||
}
|
||||
return identity;
|
||||
}
|
||||
|
||||
async mounted() {
|
||||
await accountsDB.open();
|
||||
this.numAccounts = await accountsDB.accounts.count();
|
||||
@@ -524,7 +508,7 @@ export default class NewEditProjectView extends Vue {
|
||||
if (this.numAccounts === 0) {
|
||||
console.error("Error: there is no account.");
|
||||
} else {
|
||||
const identity = await this.getIdentity(this.activeDid);
|
||||
const identity = await libsUtil.getIdentity(this.activeDid);
|
||||
this.saveProject(identity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user