parameterize main identifier (to prepare the way for multiple)

This commit is contained in:
2023-03-25 21:43:51 -06:00
parent 2e530518b1
commit 6c05d3105f
11 changed files with 148 additions and 73 deletions

View File

@@ -146,13 +146,16 @@
</template>
<script lang="ts">
import { Options, Vue } from "vue-class-component";
import { accessToken } from "@/libs/crypto";
import { accountsDB } from "../db";
import { IIdentifier } from "@veramo/core";
import { AppString } from "@/constants/app";
import * as moment from "moment";
import { AxiosError } from "axios";
import * as moment from "moment";
import * as R from "ramda";
import { Options, Vue } from "vue-class-component";
import { AppString } from "@/constants/app";
import { accountsDB, db } from "@/db";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto";
import { IIdentifier } from "@veramo/core";
@Options({
components: {},
@@ -226,13 +229,18 @@ export default class ProjectViewView extends Vue {
// 'created' hook runs when the Vue instance is first created
async created() {
await db.open();
const settings = await db.settings.get(MASTER_SETTINGS_KEY);
const activeDid = settings?.activeDid || "";
await accountsDB.open();
const num_accounts = await accountsDB.accounts.count();
if (num_accounts === 0) {
console.log("Problem! Should have a profile!");
} else {
const accounts = await accountsDB.accounts.toArray();
const identity = JSON.parse(accounts[0].identity);
const account = R.find((acc) => acc.did === activeDid, accounts);
const identity = JSON.parse(account?.identity || "undefined");
this.LoadProject(identity);
}
}