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:
@@ -144,7 +144,8 @@ import { Router } from "vue-router";
|
||||
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import TopMessage from "../components/TopMessage.vue";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
import { NotificationIface, USE_DEXIE_DB } from "../constants/app";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
import {
|
||||
accountsDBPromise,
|
||||
db,
|
||||
@@ -165,6 +166,7 @@ import {
|
||||
getHeaders,
|
||||
} from "../libs/endorserServer";
|
||||
import { logger } from "../utils/logger";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
@Component({
|
||||
methods: { claimSpecialDescription },
|
||||
components: {
|
||||
@@ -191,10 +193,24 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
async created() {
|
||||
this.loadingConfirms = true;
|
||||
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
||||
if (USE_DEXIE_DB) {
|
||||
settings = await retrieveSettingsForActiveAccount();
|
||||
}
|
||||
this.apiServer = settings.apiServer || "";
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.allContacts = await db.contacts.toArray();
|
||||
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const contactQueryResult = await platformService.dbQuery(
|
||||
"SELECT * FROM contacts",
|
||||
);
|
||||
this.allContacts = databaseUtil.mapQueryResultToValues(
|
||||
contactQueryResult,
|
||||
) as unknown as Contact[];
|
||||
if (USE_DEXIE_DB) {
|
||||
await db.open();
|
||||
this.allContacts = await db.contacts.toArray();
|
||||
}
|
||||
|
||||
let currentOrPreviousSat = DateTime.now().setZone("America/Denver");
|
||||
if (currentOrPreviousSat.weekday < 6) {
|
||||
@@ -213,10 +229,19 @@ export default class QuickActionBvcBeginView extends Vue {
|
||||
suppressMilliseconds: true,
|
||||
}) || "";
|
||||
|
||||
const accountsDB = await accountsDBPromise;
|
||||
await accountsDB.open();
|
||||
const allAccounts = await accountsDB.accounts.toArray();
|
||||
this.allMyDids = allAccounts.map((acc) => acc.did);
|
||||
const queryResult = await platformService.dbQuery(
|
||||
"SELECT did FROM accounts",
|
||||
);
|
||||
this.allMyDids =
|
||||
databaseUtil
|
||||
.mapQueryResultToValues(queryResult)
|
||||
?.map((row) => row[0] as string) || [];
|
||||
if (USE_DEXIE_DB) {
|
||||
const accountsDB = await accountsDBPromise;
|
||||
await accountsDB.open();
|
||||
const allAccounts = await accountsDB.accounts.toArray();
|
||||
this.allMyDids = allAccounts.map((acc) => acc.did);
|
||||
}
|
||||
const headers = await getHeaders(this.activeDid);
|
||||
try {
|
||||
const response = await fetch(
|
||||
|
||||
Reference in New Issue
Block a user