add SQL DB access to everywhere we are using the DB, up to the "C" files
This commit is contained in:
@@ -117,9 +117,10 @@ import { Component, Vue } from "vue-facing-decorator";
|
||||
import { RouteLocationNormalizedLoaded, Router } from "vue-router";
|
||||
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
import { NotificationIface, USE_DEXIE_DB } from "../constants/app";
|
||||
import { db, retrieveSettingsForActiveAccount } from "../db/index";
|
||||
import { Contact } from "../db/tables/contacts";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
import {
|
||||
AgreeVerifiableCredential,
|
||||
GiveSummaryRecord,
|
||||
@@ -133,6 +134,7 @@ import {
|
||||
} from "../libs/endorserServer";
|
||||
import { retrieveAccountCount } from "../libs/util";
|
||||
import { logger } from "../utils/logger";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
@Component({ components: { QuickNav } })
|
||||
export default class ContactAmountssView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
@@ -154,7 +156,18 @@ export default class ContactAmountssView extends Vue {
|
||||
async created() {
|
||||
try {
|
||||
const contactDid = this.$route.query["contactDid"] as string;
|
||||
this.contact = (await db.contacts.get(contactDid)) || null;
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const dbContact = await platformService.dbQuery(
|
||||
"SELECT * FROM contacts WHERE did = ?",
|
||||
[contactDid],
|
||||
);
|
||||
this.contact = databaseUtil.mapQueryResultToValues(
|
||||
dbContact,
|
||||
)[0] as unknown as Contact;
|
||||
if (USE_DEXIE_DB) {
|
||||
await db.open();
|
||||
this.contact = (await db.contacts.get(contactDid)) || null;
|
||||
}
|
||||
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
this.activeDid = settings?.activeDid || "";
|
||||
|
||||
Reference in New Issue
Block a user