summaryrefslogtreecommitdiffstats
path: root/js/messaging.js
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 /js/messaging.js
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
Diffstat (limited to 'js/messaging.js')
-rw-r--r--js/messaging.js18
1 files changed, 15 insertions, 3 deletions
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();
});
-
-
});