This commit is contained in:
Arek 2022-06-10 15:33:05 +02:00
parent cf2b59b751
commit b5a7c8c3c5
5 changed files with 30 additions and 10 deletions

View File

@ -0,0 +1,11 @@
function showTournaments() {
let url = 'https://dragonmaster.pl/inz/tournaments';
try {
let res = await fetch(url);
return await res.json();
} catch (error) {
console.log(error);
}
let tournaments = await showTournaments();
console.log(tournaments[1])
}

View File

@ -11,7 +11,7 @@ async function showTournaments() {
async function renderTournaments() {
let tournaments = await showTournaments();
let html = '';
console.log(tournaments)
console.log(tournaments[1])
tournaments.forEach(tournament => {
let htmlSegment = `<div class = "tournamentBox" onclick="window.location.href='_main page/pojedynczy_turniej/index.html';loca">
<div class="tournamentIconBox">
@ -58,5 +58,15 @@ function loginVisibility() {
else {
document.getElementById("login").style.display = "";
}
}
function createVisibility() {
if (localStorage.getItem("token") !== null) {
document.getElementById("creator").style.display = "none";
}
else {
document.getElementById("creator").style.display = "";
}
}

View File

@ -10,7 +10,7 @@
<script type="text/javascript" src="app.js"></script>
</head>
<body onload="renderTournaments();logoutVisibility(); loginVisibility()">
<body onload="renderTournaments();logoutVisibility(); loginVisibility(); creatorVisibility()">
<header>
<div class="logoBox">
<a class="header_link" href="./index.html"><img class="logo" src="./_global/logo.svg" alt="Logo error"></a>
@ -22,6 +22,8 @@
<a class="header_link" href="./kontakt/index.html">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 turnieju/index.html" id="creator">Tworzenie
turnieju</a>
<button class="loginButton" id="logout" onclick="logout()">Wyloguj</button>
</div>
</header>

View File

@ -44,18 +44,16 @@ function createTournament() {
"roles": document.getElementById("category").value,
"ranked": document.getElementById("rank").value,
"place": document.getElementById("place").value,
"from": "string",
"to": "string",
"from": "2020-10-10 10:10:10",
"to": "2020-10-10 10:10:10",
"rang": "rang1",
"entryFee": document.getElementById("entry-fee").value,
"director": document.getElementById("director").value,
"phone": document.getElementById("phone").value,
"entriesTo": "string",
"entriesTo": "2020-10-10 10:10:10",
"additionalInformations": document.getElementById("add-info").value,
"categotry": "cat1",
"visibility": "TRUE"
}
)
}
@ -82,7 +80,6 @@ function logoutVisibility() {
}
function loginVisibility() {
if (localStorage.getItem("token") !== null) {
document.getElementById("login").style.display = "none";
@ -91,4 +88,4 @@ function loginVisibility() {
document.getElementById("login").style.display = "";
}
}
}

View File

@ -7,10 +7,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Padel Tournaments System</title>
<link href="style.css" rel="stylesheet">
<script type="text/javascript" src="app.js"></script>
</head>
<body onload="logoutVisibility(); loginVisibility()">
<script type="text/javascript" src="app.js"></script>
<header>
<div class="logoBox">
<a class="header_link" href="../../index.html"><img class="logo" src="../../_global/logo.svg"