forked from jsnbuchanan/crowd-funder-for-time-pwa
fix more of the logging & log display
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
<div v-for="(log, index) in logs" :key="index" class="mb-2">
|
||||
<pre
|
||||
class="bg-slate-100 p-4 rounded-md overflow-x-auto whitespace-pre-wrap"
|
||||
>{{ log.message }}</pre
|
||||
>{{ log.date }} {{ log.message }}</pre
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,21 +81,22 @@ export default class LogView extends Vue {
|
||||
|
||||
let allLogs: Log[] = [];
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const queryResult = await platformService.dbQuery("SELECT * FROM logs");
|
||||
allLogs = databaseUtil.mapQueryResultToValues(
|
||||
const queryResult = await platformService.dbQuery(
|
||||
"SELECT * FROM logs ORDER BY date DESC",
|
||||
);
|
||||
this.logs = 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);
|
||||
return dateB.getTime() - dateA.getTime();
|
||||
});
|
||||
}
|
||||
|
||||
// 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);
|
||||
return dateB.getTime() - dateA.getTime();
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error("Error loading logs:", error);
|
||||
this.error =
|
||||
|
||||
Reference in New Issue
Block a user