From 25aa026f08019f018e8d5eafce1d69378db511f2 Mon Sep 17 00:00:00 2001 From: Mashintime Date: Tue, 19 Dec 2023 21:23:01 -0500 Subject: [PATCH] Fix updater error --- gui/electron/preload/index.ts | 10 ---------- gui/src/components/infoScreen_updater.vue | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/gui/electron/preload/index.ts b/gui/electron/preload/index.ts index adb7b8c5..c69813fb 100644 --- a/gui/electron/preload/index.ts +++ b/gui/electron/preload/index.ts @@ -113,16 +113,6 @@ window.onmessage = (ev) => { setTimeout(removeLoading, 4999); -window.addEventListener("DOMContentLoaded", () => { - // we are using this area for implementing the electron runUpdater - // we need access to DOM for displaying updater results in GUI - // close app, update and restart - document - .getElementById("update_and_install") - .addEventListener("click", () => { - ipcRenderer.send("request-restart-and-install-update"); - }); -}); // IPC ACTION FOR AUTO UPDATER ipcRenderer.on("action-updater", (event, arg) => { diff --git a/gui/src/components/infoScreen_updater.vue b/gui/src/components/infoScreen_updater.vue index 51aa9fa1..27bd6adf 100644 --- a/gui/src/components/infoScreen_updater.vue +++ b/gui/src/components/infoScreen_updater.vue @@ -4,7 +4,22 @@ import pinia from "../store/index"; setActivePinia(pinia); import { useStateStore } from "../store/stateStore.js"; +import { settingsStore } from "../store/settingsStore"; +import { onMounted } from "vue"; +import { ipcRenderer } from "electron"; const state = useStateStore(pinia); +onMounted(() => { + window.addEventListener("DOMContentLoaded", () => { + // we are using this area for implementing the electron runUpdater + // we need access to DOM for displaying updater results in GUI + // close app, update and restart + document + .getElementById("update_and_install") + .addEventListener("click", () => { + ipcRenderer.send("request-restart-and-install-update"); + }); +}); +})