fix: 🐛 fix some views

This commit is contained in:
Arek 2022-06-19 22:50:57 +02:00
parent 86556b76bb
commit 781c45fe49
5 changed files with 35 additions and 10 deletions

View File

@ -10,6 +10,33 @@ async function showTournaments() {
} }
} }
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("zapisy").style.display = "none";
document.getElementById("drabinka").style.display = "none";
}
else {
document.getElementById("zapisy").style.display = '';
document.getElementById("drabinka").style.display = '';
}
})
}
else {
document.getElementById("zapisy").style.display = "none";
document.getElementById("drabinka").style.display = "none";
}
}
function logout() { function logout() {
localStorage.removeItem('token'); localStorage.removeItem('token');
location.reload(); location.reload();

View File

@ -58,13 +58,10 @@
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 6px 15px; margin-top: 0.5%;
gap: 10px;
margin-top: 1%;
/*position: absolute;*/ /*position: absolute;*/
width: 73px; width: 90px;
height: 29px; height: 29px;
/* PFP GREEN */ /* PFP GREEN */

View File

@ -10,7 +10,7 @@
<script type="text/javascript" src="app.js"></script> <script type="text/javascript" src="app.js"></script>
</head> </head>
<body onload="renderTournaments();logoutVisibility(); loginVisibility();"> <body onload="renderTournaments();logoutVisibility(); loginVisibility(); checkRole();">
<header> <header>
<div class="logoBox"> <div class="logoBox">
<a class="header_link" href="../../index.html"><img class="logo" src="../../../_global/logo.svg" <a class="header_link" href="../../index.html"><img class="logo" src="../../../_global/logo.svg"
@ -51,8 +51,8 @@
<nav> <nav>
<ul> <ul>
<li><a href="#">Informacje</a></li> <li><a href="#">Informacje</a></li>
<li><a href="zapisy/index.html">Zapisy</a></li> <li id="zapisy"><a href="zapisy/index.html">Zapisy</a></li>
<li><a href="drabinka/index.html">Drabinka</a></li> <li id="drabinka"><a href="drabinka/index.html">Drabinka</a></li>
</ul> </ul>
</nav> </nav>
</div> </div>

View File

@ -96,7 +96,7 @@ async function renderTournaments(organiserTournament) {
${tournament.place} ${tournament.place}
${tournament.from} do ${tournament.to} ${tournament.from} do ${tournament.to}
<button class="tournamentOpen">OPEN</button> <button class="tournamentOpen">${tournament.rang}</button>
</div> </div>
</div> </div>

View File

@ -119,7 +119,8 @@
</div> </div>
<button class="cancelButton" type="button" id="cancel" onclick="">Anuluj</button> <button class="cancelButton" type="button" id="cancel"
onclick="window.location.href = '../../normal_user/index.html'">Anuluj</button>
<button class="submitButton" type="submit" id="tournamentsubmit" onclick="createTournament()"> <button class="submitButton" type="submit" id="tournamentsubmit" onclick="createTournament()">
Załóż turniej Załóż turniej