fix: 🐛 Now user and unlogged user cant see ,,tworzenie turnieju"
This commit is contained in:
parent
5ce2883a53
commit
6392fea39c
@ -64,12 +64,39 @@ function loginVisibility() {
|
||||
}
|
||||
}
|
||||
|
||||
function createVisibility() {
|
||||
|
||||
function checkRole() {
|
||||
if (localStorage.getItem("token") !== null) {
|
||||
|
||||
fetch('https://dragonmaster.pl/inz/user', {
|
||||
headers: {
|
||||
Authorization: ("Bearer " + localStorage.getItem("token"))
|
||||
}
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
if (json['role'] == '1') {
|
||||
document.getElementById("creator").style.display = "none";
|
||||
}
|
||||
else {
|
||||
document.getElementById("creator").style.display = "";
|
||||
|
||||
document.getElementById("creator").style.display = '';
|
||||
}
|
||||
})
|
||||
}
|
||||
else {
|
||||
document.getElementById("creator").style.display = "none";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// function creatorVisibility() {
|
||||
// if (localStorage.getItem("token") == null) {
|
||||
// document.getElementById("creator").style.display = "none";
|
||||
// }
|
||||
// else if (checkRole()) {
|
||||
// document.getElementById("creator").style.display = "none";
|
||||
// }
|
||||
// else {
|
||||
// document.getElementById("creator").style.display = "";
|
||||
// }
|
||||
// }
|
@ -10,7 +10,7 @@
|
||||
<script type="text/javascript" src="app.js"></script>
|
||||
</head>
|
||||
|
||||
<body onload="renderTournaments();logoutVisibility(); loginVisibility(); creatorVisibility();">
|
||||
<body onload="renderTournaments();logoutVisibility(); loginVisibility(); checkRole();">
|
||||
<header>
|
||||
<div class="logoBox">
|
||||
<a class="header_link" href="./index.html"><img class="logo" src="./_global/logo.svg" alt="Logo error"></a>
|
||||
|
Loading…
Reference in New Issue
Block a user