This commit is contained in:
asyncnomi 2022-12-21 23:42:53 +01:00
parent 1829515873
commit d416e62d65
2 changed files with 17 additions and 2 deletions

View file

@ -80,7 +80,7 @@
</div>
<div id="admin-page" style="display: none">
</div> <!-- end admin page -->
<div class="container" id="login-page" style="display: none;">

View file

@ -37,6 +37,7 @@ $("#login-button").click(function (e) {
if(data.success) {
localStorage.setItem("token", data.token);
localStorage.setItem("user", data.user);
localStorage.setItem("isAdmin", data.isAdmin);
show_page('#demande-page');
} else {
@ -48,7 +49,7 @@ $("#login-button").click(function (e) {
});
$("#prank-button").click(function () {
if(localStorage.getItem('token')) {
if (localStorage.getItem('token')) {
show_page('#demande-page');
}
else {
@ -56,6 +57,20 @@ $("#prank-button").click(function () {
}
});
$("#logo").click(function () {
if (localStorage.getItem('token')) {
if (localStorage.getItem('isAdmin')) {
show_page('#admin-page');
}
else {
show_page('#demande-page');
}
}
else {
show_page('#login-page');
}
});
$(window).on("load", function() {
/* Register the Service Worker */