From 74d79204ec32351bc629dbd34983a5ac4443ff8c Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Sat, 10 Feb 2024 12:57:33 +0000 Subject: [PATCH] [CodeFactor] Apply fixes to commit ec34a69 --- gui/src/js/eventHandler.js | 10 ++++++---- gui/src/store/settingsStore.js | 7 +++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gui/src/js/eventHandler.js b/gui/src/js/eventHandler.js index e0b4cd0c..7e4aa239 100644 --- a/gui/src/js/eventHandler.js +++ b/gui/src/js/eventHandler.js @@ -24,7 +24,10 @@ setActivePinia(pinia); import { useStateStore } from "../store/stateStore.js"; const stateStore = useStateStore(pinia); -import { settingsStore as settings, getRemote } from "../store/settingsStore.js"; +import { + settingsStore as settings, + getRemote, +} from "../store/settingsStore.js"; export function connectionFailed(endpoint, event) { stateStore.modem_connection = "disconnected"; @@ -129,10 +132,9 @@ export function eventDispatcher(data) { displayToast("success", "bi-ethernet", message, 5000); stateStore.modem_connection = "connected"; - getRemote().then(() => { - //initConnections(); - getModemState(); + //initConnections(); + getModemState(); }); //getConfig(); diff --git a/gui/src/store/settingsStore.js b/gui/src/store/settingsStore.js index d3a480bc..c0c975db 100644 --- a/gui/src/store/settingsStore.js +++ b/gui/src/store/settingsStore.js @@ -99,7 +99,7 @@ const defaultConfig = { tci_port: 0, }, }, -} +}; nconf.defaults(defaultConfig.local); nconf.required(["local:host", "local:port"]); @@ -118,17 +118,16 @@ export function onChange() { export function getRemote() { return getConfig().then((conf) => { - if (typeof conf !== 'undefined') { + if (typeof conf !== "undefined") { settingsStore.remote = conf; onChange(); } else { - console.warn('Received undefined configuration, using default!'); + console.warn("Received undefined configuration, using default!"); settingsStore.remote = defaultConfig.remote; } }); } - watch(settingsStore.local, (oldValue, newValue) => { //This function watches for changes, and triggers a save of local settings saveLocalSettingsToConfig();