separate account from other data for backup/restore

This commit is contained in:
2023-03-19 16:25:19 -06:00
parent fb44c8aa48
commit 45b54db01e
14 changed files with 99 additions and 95 deletions

View File

@@ -78,7 +78,7 @@
<script lang="ts">
import { Options, Vue } from "vue-class-component";
import { AppString } from "@/constants/app";
import { db } from "../db";
import { accountsDB } from "../db";
import { accessToken, SimpleSigner } from "@/libs/crypto";
import * as didJwt from "did-jwt";
import { IIdentifier } from "@veramo/core";
@@ -112,12 +112,12 @@ export default class NewEditProjectView extends Vue {
if (this.projectId === "") {
console.log("This is a new project");
} else {
await db.open();
const num_accounts = await db.accounts.count();
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 db.accounts.toArray();
const accounts = await accountsDB.accounts.toArray();
const identity = JSON.parse(accounts[0].identity);
this.LoadProject(identity);
}
@@ -254,12 +254,12 @@ export default class NewEditProjectView extends Vue {
public async onSaveProjectClick() {
this.isHiddenSave = true;
this.isHiddenSpinner = false;
await db.open();
const num_accounts = await db.accounts.count();
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 db.accounts.toArray();
const accounts = await accountsDB.accounts.toArray();
const identity = JSON.parse(accounts[0].identity);
this.SaveProject(identity);
}