forked from trent_larson/crowd-funder-for-time-pwa
convert all remaining DB writes & reads to SQL (with successful registration & claim)
This commit is contained in:
@@ -55,6 +55,9 @@ import TopMessage from "../components/TopMessage.vue";
|
||||
import { db } from "../db/index";
|
||||
import { Log } from "../db/tables/logs";
|
||||
import { logger } from "../utils/logger";
|
||||
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
|
||||
import { USE_DEXIE_DB } from "../constants/app";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
@@ -76,9 +79,19 @@ export default class LogView extends Vue {
|
||||
async loadLogs() {
|
||||
try {
|
||||
this.error = null; // Clear any previous errors
|
||||
await db.open();
|
||||
// Get all logs and sort by date in reverse chronological order
|
||||
const allLogs = await db.logs.toArray();
|
||||
|
||||
let allLogs: Log[] = [];
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const queryResult = await platformService.dbQuery("SELECT * FROM logs");
|
||||
allLogs = databaseUtil.mapQueryResultToValues(
|
||||
queryResult,
|
||||
) as unknown as Log[];
|
||||
if (USE_DEXIE_DB) {
|
||||
await db.open();
|
||||
allLogs = await db.logs.toArray();
|
||||
}
|
||||
|
||||
// Sort by date in reverse chronological order
|
||||
this.logs = allLogs.sort((a, b) => {
|
||||
const dateA = new Date(a.date);
|
||||
const dateB = new Date(b.date);
|
||||
|
||||
Reference in New Issue
Block a user