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
- Operator
- If only one callingPoint, a string is returned instead of an array.
* Change dockerfile to deploy with brotli support for faster laoding.
### In Progress:

View File

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