88 lines
2.9 KiB
HTML
88 lines
2.9 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Padel Tournaments System</title>
|
|
<link href="style.css" rel="stylesheet">
|
|
<script>function logout() {
|
|
localStorage.removeItem('token');
|
|
location.reload();
|
|
}
|
|
|
|
function logoutVisibility() {
|
|
if (localStorage.getItem("token") !== null) {
|
|
document.getElementById("logout").style.display = "";
|
|
}
|
|
else {
|
|
document.getElementById("logout").style.display = "none";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
function loginVisibility() {
|
|
if (localStorage.getItem("token") !== null) {
|
|
document.getElementById("login").style.display = "none";
|
|
}
|
|
else {
|
|
document.getElementById("login").style.display = "";
|
|
|
|
}
|
|
}
|
|
|
|
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 = '';
|
|
}
|
|
})
|
|
}
|
|
else {
|
|
document.getElementById("creator").style.display = "none";
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body onload="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>
|
|
</div>
|
|
<div class="linkBox">
|
|
<!-- <span class="dot">JM</span>-->
|
|
<button class="loginButton" type="submit" onclick="window.location.href='../logowanie/index.html'"
|
|
id="login">LOGOWANIE</button>
|
|
<button class="loginButton" id="logout" onclick="logout()">Wyloguj</button>
|
|
<a class="header-link" href="#">Kontakt</a>
|
|
<a class="header_link" href="../ranking/index.html">Ranking</a>
|
|
<a class="header_link" href="../index.html">Kalendarz turniejów</a>
|
|
<a class="header_link" href="../../panel_organizatora/dodawanie%20turnieju/index.html"
|
|
id="creator">Tworzenie
|
|
turnieju</a>
|
|
</div>
|
|
</header>
|
|
|
|
|
|
<div class="container">
|
|
<h1>Strona w budowie</h1>
|
|
</div>
|
|
</body>
|
|
|
|
</html> |