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:
@@ -102,13 +102,17 @@ import TopMessage from "../components/TopMessage.vue";
|
||||
import {
|
||||
DEFAULT_PARTNER_API_SERVER,
|
||||
NotificationIface,
|
||||
USE_DEXIE_DB,
|
||||
} from "../constants/app";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
import { db } from "../db/index";
|
||||
import { Contact } from "../db/tables/contacts";
|
||||
import { didInfo, getHeaders } from "../libs/endorserServer";
|
||||
import { UserProfile } from "../libs/partnerServer";
|
||||
import { retrieveAccountDids } from "../libs/util";
|
||||
import { logger } from "../utils/logger";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
import { Settings } from "@/db/tables/settings";
|
||||
@Component({
|
||||
components: {
|
||||
LMap,
|
||||
@@ -135,12 +139,29 @@ export default class UserProfileView extends Vue {
|
||||
didInfo = didInfo;
|
||||
|
||||
async mounted() {
|
||||
const settings = await db.settings.toArray();
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const settingsQuery = await platformService.dbQuery(
|
||||
"SELECT * FROM settings",
|
||||
);
|
||||
let settings = databaseUtil.mapQueryResultToValues(
|
||||
settingsQuery,
|
||||
) as Settings[];
|
||||
if (USE_DEXIE_DB) {
|
||||
settings = await db.settings.toArray();
|
||||
}
|
||||
this.activeDid = settings[0]?.activeDid || "";
|
||||
this.partnerApiServer =
|
||||
settings[0]?.partnerApiServer || this.partnerApiServer;
|
||||
|
||||
this.allContacts = await db.contacts.toArray();
|
||||
const contactQuery = await platformService.dbQuery(
|
||||
"SELECT * FROM contacts",
|
||||
);
|
||||
this.allContacts = databaseUtil.mapQueryResultToValues(
|
||||
contactQuery,
|
||||
) as unknown as Contact[];
|
||||
if (USE_DEXIE_DB) {
|
||||
this.allContacts = await db.contacts.toArray();
|
||||
}
|
||||
this.allMyDids = await retrieveAccountDids();
|
||||
|
||||
await this.loadProfile();
|
||||
|
||||
Reference in New Issue
Block a user