summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-02-09 00:48:40 +0100
committerAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-02-09 00:48:40 +0100
commitb5e17275d72bd5cc692d8ecfafd5726c2b5867b7 (patch)
tree96462ac026dbc270616eb7774ccf82419947d41d
parentupdated version and service worker files (diff)
downloadbeziapp-b5e17275d72bd5cc692d8ecfafd5726c2b5867b7.tar
beziapp-b5e17275d72bd5cc692d8ecfafd5726c2b5867b7.tar.gz
beziapp-b5e17275d72bd5cc692d8ecfafd5726c2b5867b7.tar.bz2
beziapp-b5e17275d72bd5cc692d8ecfafd5726c2b5867b7.tar.lz
beziapp-b5e17275d72bd5cc692d8ecfafd5726c2b5867b7.tar.xz
beziapp-b5e17275d72bd5cc692d8ecfafd5726c2b5867b7.tar.zst
beziapp-b5e17275d72bd5cc692d8ecfafd5726c2b5867b7.zip
-rw-r--r--js/about.js2
-rw-r--r--js/messaging.js18
2 files changed, 16 insertions, 4 deletions
diff --git a/js/about.js b/js/about.js
index 836ffaf..8dd55ab 100644
--- a/js/about.js
+++ b/js/about.js
@@ -17,4 +17,4 @@ document.addEventListener("DOMContentLoaded", () => {
// Setup side menu
const menus = document.querySelectorAll(".side-menu");
M.Sidenav.init(menus, { edge: "right", draggable: true });
-}); \ No newline at end of file
+});
diff --git a/js/messaging.js b/js/messaging.js
index 0578a1a..44e027a 100644
--- a/js/messaging.js
+++ b/js/messaging.js
@@ -1,3 +1,16 @@
+async function checkLogin() {
+ localforage.getItem("logged_in").then(function (value) {
+ // This code runs once the value has been loaded
+ // from the offline store.
+ if (value !== true) {
+ window.location.replace("/index.html");
+ }
+ }).catch(function (err) {
+ // This code runs if there were any errors
+ console.log(err);
+ });
+}
+
function htmlEncode(value){
// Create a in-memory element, set its inner text (which is automatically encoded)
// Then grab the encoded contents back out. The element never exists on the DOM.
@@ -263,8 +276,9 @@ function validateName() {
console.log(err);
});
}
-var additionalstufftoaddtomessage;
+var additionalstufftoaddtomessage = "";
document.addEventListener('DOMContentLoaded', function() {
+ checkLogin();
var elems = document.querySelectorAll('.autocomplete-fullname');
localforage.getItem('directory').then(function(value) {
// vse editam v nanotu
@@ -325,6 +339,4 @@ var additionalstufftoaddtomessage;
}
input.click();
});
-
-
});