diff options
author | sijanec <sijanecantonluka@gmail.com> | 2020-05-17 00:13:40 +0200 |
---|---|---|
committer | sijanec <sijanecantonluka@gmail.com> | 2020-05-17 00:13:40 +0200 |
commit | fc66b376cb3a2c73843cc882d500cfd743c0790e (patch) | |
tree | c94ab426742180e88100629102fa7c21eb820a58 /js/setup-storage.js | |
parent | Handlers moved from HTML to JS (diff) | |
download | beziapp-fc66b376cb3a2c73843cc882d500cfd743c0790e.tar beziapp-fc66b376cb3a2c73843cc882d500cfd743c0790e.tar.gz beziapp-fc66b376cb3a2c73843cc882d500cfd743c0790e.tar.bz2 beziapp-fc66b376cb3a2c73843cc882d500cfd743c0790e.tar.lz beziapp-fc66b376cb3a2c73843cc882d500cfd743c0790e.tar.xz beziapp-fc66b376cb3a2c73843cc882d500cfd743c0790e.tar.zst beziapp-fc66b376cb3a2c73843cc882d500cfd743c0790e.zip |
Diffstat (limited to 'js/setup-storage.js')
-rw-r--r-- | js/setup-storage.js | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/js/setup-storage.js b/js/setup-storage.js deleted file mode 100644 index a37fc8f..0000000 --- a/js/setup-storage.js +++ /dev/null @@ -1,37 +0,0 @@ -async function setupStorage(force = false) { - let logged_in; - promises_check_if_already_installed = [ - localforage.getItem("logged_in").then( function(val) { - console.log("[setupStorage] logged in status: "+val); - logged_in = val; - }) - ]; - await Promise.all(promises_check_if_already_installed); - - let promises_update = [ - localforage.setItem("profile", {}), - localforage.setItem("timetable", []), - localforage.setItem("teachers", []), - localforage.setItem("gradings", []), - localforage.setItem("grades", []), - localforage.setItem("absences", {}), - localforage.setItem("messages", { "0": [], "1": [], "2": []}), // see messages.js:129, commit 8eb9ca9caca30fbbe023243657535ab4088be377 - localforage.setItem("directory", {}), //\\ well I could remember my own code but I didn't. - localforage.setItem("meals", {}) - ]; - - if (logged_in && force == false) { // torej, če je že bila prijava narejena, ne posodobi backwards-compatible vrednosti (username, password,...) - await Promise.all(promises_update); - console.log("[setupStorage] user logged in: only updated"); - } else { - let promises_first_install = [ - localforage.setItem("logged_in", false), - localforage.setItem("username", ""), - localforage.setItem("password", ""), - localforage.setItem("chosenLang", "en") - ]; - await localforage.clear(); - await Promise.all(promises_first_install); - console.log("[setupStorage] user not logged in: set up whole database"); - } -} |