summaryrefslogtreecommitdiffstats
path: root/js/initialize.js
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-05-20 21:47:41 +0200
committerGitHub <noreply@github.com>2020-05-20 21:47:41 +0200
commit9e63ad7fd187b5eea9f2e3d3a1e1fa9a2d1ec1d2 (patch)
treec96e2c622aeb56000d4736ba1932269f2dfd217b /js/initialize.js
parentMerge pull request #8 from beziapp/dev (diff)
parentMerge branch 'dev' of ssh://github.com/beziapp/beziapp.github.io into dev (diff)
downloadbeziapp-9e63ad7fd187b5eea9f2e3d3a1e1fa9a2d1ec1d2.tar
beziapp-9e63ad7fd187b5eea9f2e3d3a1e1fa9a2d1ec1d2.tar.gz
beziapp-9e63ad7fd187b5eea9f2e3d3a1e1fa9a2d1ec1d2.tar.bz2
beziapp-9e63ad7fd187b5eea9f2e3d3a1e1fa9a2d1ec1d2.tar.lz
beziapp-9e63ad7fd187b5eea9f2e3d3a1e1fa9a2d1ec1d2.tar.xz
beziapp-9e63ad7fd187b5eea9f2e3d3a1e1fa9a2d1ec1d2.tar.zst
beziapp-9e63ad7fd187b5eea9f2e3d3a1e1fa9a2d1ec1d2.zip
Diffstat (limited to 'js/initialize.js')
-rw-r--r--js/initialize.js39
1 files changed, 0 insertions, 39 deletions
diff --git a/js/initialize.js b/js/initialize.js
deleted file mode 100644
index 39ed505..0000000
--- a/js/initialize.js
+++ /dev/null
@@ -1,39 +0,0 @@
-function setupStorage() {
- promises_to_run = [
- localforage.setItem("logged_in", false),
- localforage.setItem("username", ""),
- localforage.setItem("password", ""),
- localforage.setItem("profile", {}),
- localforage.setItem("timetable", []),
- localforage.setItem("teachers", []),
- localforage.setItem("gradings", []),
- localforage.setItem("grades", []),
- localforage.setItem("absences", {}),
- localforage.setItem("messages", {})
- ];
-
- Promise.all(promises_to_run)
- .then(
- window.location.replace("/login.html")
- );
-}
-
-localforage.getItem("logged_in")
- .then(
- function (value) {
- // This code runs once the value has been loaded
- // from the offline store.
- if (value === null) {
- setupStorage();
- } else if (value === false) {
- window.location.replace("/login.html");
- } else {
- window.location.replace("/pages/timetable.html");
- }
- }
- ).catch(
- function (err) {
- // This code runs if there were any errors
- console.log(err);
- }
- );