blob: d7e5b713525aa82600ebd7da2c56deb9e332b884 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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";
}
});
|