forked from jsnbuchanan/crowd-funder-for-time-pwa
convert all remaining DB writes & reads to SQL (with successful registration & claim)
This commit is contained in:
@@ -46,11 +46,14 @@ import { Router } from "vue-router";
|
||||
import { useClipboard } from "@vueuse/core";
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import TopMessage from "../components/TopMessage.vue";
|
||||
import { NotificationIface, APP_SERVER } from "../constants/app";
|
||||
import { NotificationIface, APP_SERVER, USE_DEXIE_DB } from "../constants/app";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
import { db, retrieveSettingsForActiveAccount } from "../db/index";
|
||||
import { retrieveAccountMetadata } from "../libs/util";
|
||||
import { generateEndorserJwtUrlForAccount } from "../libs/endorserServer";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
import { logger } from "../utils/logger";
|
||||
|
||||
@Component({
|
||||
components: { QuickNav, TopMessage },
|
||||
})
|
||||
@@ -63,7 +66,10 @@ export default class ShareMyContactInfoView extends Vue {
|
||||
}
|
||||
|
||||
async onClickShare() {
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
||||
if (USE_DEXIE_DB) {
|
||||
settings = await retrieveSettingsForActiveAccount();
|
||||
}
|
||||
const activeDid = settings.activeDid || "";
|
||||
const givenName = settings.firstName || "";
|
||||
const isRegistered = !!settings.isRegistered;
|
||||
@@ -71,7 +77,17 @@ export default class ShareMyContactInfoView extends Vue {
|
||||
|
||||
const account = await retrieveAccountMetadata(activeDid);
|
||||
|
||||
const numContacts = await db.contacts.count();
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const contactQueryResult = await platformService.dbQuery(
|
||||
"SELECT COUNT(*) FROM contacts",
|
||||
);
|
||||
let numContacts =
|
||||
(databaseUtil.mapQueryResultToValues(
|
||||
contactQueryResult,
|
||||
)?.[0]?.[0] as number) || 0;
|
||||
if (USE_DEXIE_DB) {
|
||||
numContacts = await db.contacts.count();
|
||||
}
|
||||
|
||||
if (account) {
|
||||
const message = await generateEndorserJwtUrlForAccount(
|
||||
|
||||
Reference in New Issue
Block a user