blob: 68b2d5a64d8024efb1266b18ed4716fbe9687677 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
fetch("/auth/api/status").then(response => response.json()).then(response => {
console.log(response);
const first = document.querySelectorAll("a")[0];
const second = document.querySelectorAll("a")[1];
const third = document.querySelectorAll("a")[2];
if (!response.admin)
third.style.display = "none";
if (response.loggedIn) {
first.href = "/auth/change.html";
first.innerText = "Passwort ändern";
second.href = "/auth/api/logout";
second.innerText = "Logout";
if (response.admin) {
third.href = "/admin";
third.innerText = "Admin";
}
} else {
document.querySelectorAll("div.pure-menu")[0].style.display = "none";
}
});
|