aboutsummaryrefslogtreecommitdiff
path: root/overview/public/script.js
blob: be058b7fc04456eaa2e58d1db2896d55934c8240 (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 = "Administration";
		}
	} else {
		document.querySelectorAll("div.pure-menu")[0].style.display = "none";
	}
});