-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (24 loc) · 803 Bytes
/
script.js
File metadata and controls
29 lines (24 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
if (localStorage.getItem("messago-token") == null && localStorage.getItem("messago-username") == null) {
console.log(localStorage.getItem("messago-token"))
console.log(localStorage.getItem("messago-username"))
window.location.href = "/login";
}
fetch("http://127.0.0.1:8081/check", {
method: "POST",
body: JSON.stringify({ username: localStorage.getItem("messago-username"), token: localStorage.getItem("messago-token") }),
headers: {
"Content-Type": "application/json"
}
}).then(res => res.json()).then(n => {
console.log("exists? ", n.exists);
if (!n.exists) {
window.location.href = "/login";
}
});
function loadFeed() {
}
window.onload = loadFeed;
function logout() {
localStorage.clear();
window.location.href = "/login";
}