Frontend: Fix fallback to default settings

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-01-23 21:14:53 +00:00
parent 5a8f3f0d85
commit bfb7d56983
2 changed files with 11 additions and 4 deletions

View File

@ -14,6 +14,7 @@
- Platform number - Platform number
- Operator - Operator
- If only one callingPoint, a string is returned instead of an array. - If only one callingPoint, a string is returned instead of an array.
* Change dockerfile to deploy with brotli support for faster laoding.
### In Progress: ### In Progress:

View File

@ -7,6 +7,7 @@ async function storageAvailable(type) { // Currently not used
let x = '__storage_test__'; let x = '__storage_test__';
storage.setItem(x, "test"); storage.setItem(x, "test");
storage.getItem(x); storage.getItem(x);
storage.removeItem(x);
log(`lib.main.storageAvailable: ${type} is available`, "INFO") log(`lib.main.storageAvailable: ${type} is available`, "INFO")
return true; return true;
} catch (err) { } catch (err) {
@ -77,12 +78,17 @@ async function setLoadingDesc(desc) {
/* Fetch User Settings */ /* Fetch User Settings */
async function getQuickLinks() { async function getQuickLinks() {
var defaults =
["bri","lwh","srd","mtp","rda","cfn",
"sml","shh","pri","avn","sar","svb"];
try { try {
var data = JSON.parse(localStorage.getItem("qlOpt")); if (localStorage.getItem("qlOpt")) {
var data = JSON.parse(localStorage.getItem("qlOpt"));
} else {
data = defaults;
}
} catch (err) { } catch (err) {
var data = data = defaults;
["bri","lwh","srd","mtp","rda","cfn",
"sml","shh","pri","avn","sar","svb"];
} }
return data; return data;
} }