Website-v1/login/js/auth.js
2021-11-23 23:32:05 +01:00

20 lines
414 B
JavaScript

class Auth {
constructor() {
document.querySelector("body").style.display = "none";
const auth = localStorage.getItem("auth");
this.validateAuth(auth);
}
validateAuth(auth) {
if (auth != 1) {
window.location.replace("/");
} else {
document.querySelector("body").style.display = "block";
}
}
logOut() {
localStorage.removeItem("auth");
window.location.replace("/");
}
}