diff --git a/client/pages/config/log.vue b/client/pages/config/log.vue index a5939852..756261b7 100644 --- a/client/pages/config/log.vue +++ b/client/pages/config/log.vue @@ -8,7 +8,7 @@
{{ log.timestamp }}
@@ -136,7 +136,15 @@ export default { this.loadedLogs = this.loadedLogs.slice(-5000) } }, - init(attempts = 0) { + async loadLoggerData() { + const loggerData = await this.$axios.$get('/api/logger-data').catch((error) => { + console.error('Failed to load logger data', error) + this.$toast.error('Failed to load logger data') + }) + + this.loadedLogs = loggerData?.currentDailyLogs || [] + }, + async init(attempts = 0) { if (!this.$root.socket) { if (attempts > 10) { return console.error('Failed to setup socket listeners') @@ -147,14 +155,11 @@ export default { return } + await this.loadLoggerData() + this.newServerSettings = this.serverSettings ? { ...this.serverSettings } : {} - this.$root.socket.on('daily_logs', this.dailyLogsLoaded) this.$root.socket.on('log', this.logEvtReceived) this.$root.socket.emit('set_log_listener', this.newServerSettings.logLevel) - this.$root.socket.emit('fetch_daily_logs') - }, - dailyLogsLoaded(lines) { - this.loadedLogs = lines } }, updated() { @@ -166,13 +171,15 @@ export default { beforeDestroy() { if (!this.$root.socket) return this.$root.socket.emit('remove_log_listener') - this.$root.socket.off('daily_logs', this.dailyLogsLoaded) this.$root.socket.off('log', this.logEvtReceived) } }