mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
[CodeFactor] Apply fixes to commit ec34a69
This commit is contained in:
parent
ec34a690e9
commit
74d79204ec
2 changed files with 9 additions and 8 deletions
|
@ -24,7 +24,10 @@ setActivePinia(pinia);
|
||||||
import { useStateStore } from "../store/stateStore.js";
|
import { useStateStore } from "../store/stateStore.js";
|
||||||
const stateStore = useStateStore(pinia);
|
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) {
|
export function connectionFailed(endpoint, event) {
|
||||||
stateStore.modem_connection = "disconnected";
|
stateStore.modem_connection = "disconnected";
|
||||||
|
@ -129,10 +132,9 @@ export function eventDispatcher(data) {
|
||||||
displayToast("success", "bi-ethernet", message, 5000);
|
displayToast("success", "bi-ethernet", message, 5000);
|
||||||
stateStore.modem_connection = "connected";
|
stateStore.modem_connection = "connected";
|
||||||
|
|
||||||
|
|
||||||
getRemote().then(() => {
|
getRemote().then(() => {
|
||||||
//initConnections();
|
//initConnections();
|
||||||
getModemState();
|
getModemState();
|
||||||
});
|
});
|
||||||
|
|
||||||
//getConfig();
|
//getConfig();
|
||||||
|
|
|
@ -99,7 +99,7 @@ const defaultConfig = {
|
||||||
tci_port: 0,
|
tci_port: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
nconf.defaults(defaultConfig.local);
|
nconf.defaults(defaultConfig.local);
|
||||||
nconf.required(["local:host", "local:port"]);
|
nconf.required(["local:host", "local:port"]);
|
||||||
|
@ -118,17 +118,16 @@ export function onChange() {
|
||||||
|
|
||||||
export function getRemote() {
|
export function getRemote() {
|
||||||
return getConfig().then((conf) => {
|
return getConfig().then((conf) => {
|
||||||
if (typeof conf !== 'undefined') {
|
if (typeof conf !== "undefined") {
|
||||||
settingsStore.remote = conf;
|
settingsStore.remote = conf;
|
||||||
onChange();
|
onChange();
|
||||||
} else {
|
} else {
|
||||||
console.warn('Received undefined configuration, using default!');
|
console.warn("Received undefined configuration, using default!");
|
||||||
settingsStore.remote = defaultConfig.remote;
|
settingsStore.remote = defaultConfig.remote;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
watch(settingsStore.local, (oldValue, newValue) => {
|
watch(settingsStore.local, (oldValue, newValue) => {
|
||||||
//This function watches for changes, and triggers a save of local settings
|
//This function watches for changes, and triggers a save of local settings
|
||||||
saveLocalSettingsToConfig();
|
saveLocalSettingsToConfig();
|
||||||
|
|
Loading…
Reference in a new issue