update added jwt tokens
This commit is contained in:
1 parent
a5e28c5533
commit
b0064a9b81
25 files changed
+2004
-31
No files matched your search
@@ -0,0 +1,35 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
var theme = localStorage.getItem("bs-theme");
|
||||
if (theme) {
|
||||
document.documentElement.setAttribute("data-bs-theme", theme);
|
||||
if (theme === "dark") {
|
||||
themecheckbox.checked = true;
|
||||
}
|
||||
}
|
||||
if (localStorage.getItem("token")) {
|
||||
fetch(routes.access(), {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ token: localStorage.getItem("token") }),
|
||||
})
|
||||
.then((data) => data.json())
|
||||
.then((jsondata) => {
|
||||
if (jsondata.success) {
|
||||
document.querySelector(".loginform").classList.remove("active");
|
||||
get_all_users();
|
||||
} else {
|
||||
document.querySelector(".loginform").classList.add("active");
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
notification(`Ошибка на сервере: ${error}`, "error");
|
||||
});
|
||||
usernameheader.innerHTML = JSON.parse(
|
||||
localStorage.getItem("userdata"),
|
||||
).username;
|
||||
} else {
|
||||
document.querySelector(".loginform").classList.add("active");
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user