fix:
This commit is contained in:
parent
cf2b59b751
commit
b5a7c8c3c5
11
frontend/_main page/pojedynczy_turniej/app.js
Normal file
11
frontend/_main page/pojedynczy_turniej/app.js
Normal 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])
|
||||||
|
}
|
@ -11,7 +11,7 @@ async function showTournaments() {
|
|||||||
async function renderTournaments() {
|
async function renderTournaments() {
|
||||||
let tournaments = await showTournaments();
|
let tournaments = await showTournaments();
|
||||||
let html = '';
|
let html = '';
|
||||||
console.log(tournaments)
|
console.log(tournaments[1])
|
||||||
tournaments.forEach(tournament => {
|
tournaments.forEach(tournament => {
|
||||||
let htmlSegment = `<div class = "tournamentBox" onclick="window.location.href='_main page/pojedynczy_turniej/index.html';loca">
|
let htmlSegment = `<div class = "tournamentBox" onclick="window.location.href='_main page/pojedynczy_turniej/index.html';loca">
|
||||||
<div class="tournamentIconBox">
|
<div class="tournamentIconBox">
|
||||||
@ -60,3 +60,13 @@ function loginVisibility() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createVisibility() {
|
||||||
|
if (localStorage.getItem("token") !== null) {
|
||||||
|
document.getElementById("creator").style.display = "none";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById("creator").style.display = "";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -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(); creatorVisibility()">
|
||||||
<header>
|
<header>
|
||||||
<div class="logoBox">
|
<div class="logoBox">
|
||||||
<a class="header_link" href="./index.html"><img class="logo" src="./_global/logo.svg" alt="Logo error"></a>
|
<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="./kontakt/index.html">Kontakt</a>
|
||||||
<a class="header_link" href="./ranking/index.html">Ranking</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="./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>
|
<button class="loginButton" id="logout" onclick="logout()">Wyloguj</button>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@ -44,18 +44,16 @@ function createTournament() {
|
|||||||
"roles": document.getElementById("category").value,
|
"roles": document.getElementById("category").value,
|
||||||
"ranked": document.getElementById("rank").value,
|
"ranked": document.getElementById("rank").value,
|
||||||
"place": document.getElementById("place").value,
|
"place": document.getElementById("place").value,
|
||||||
"from": "string",
|
"from": "2020-10-10 10:10:10",
|
||||||
"to": "string",
|
"to": "2020-10-10 10:10:10",
|
||||||
"rang": "rang1",
|
"rang": "rang1",
|
||||||
"entryFee": document.getElementById("entry-fee").value,
|
"entryFee": document.getElementById("entry-fee").value,
|
||||||
"director": document.getElementById("director").value,
|
"director": document.getElementById("director").value,
|
||||||
"phone": document.getElementById("phone").value,
|
"phone": document.getElementById("phone").value,
|
||||||
"entriesTo": "string",
|
"entriesTo": "2020-10-10 10:10:10",
|
||||||
"additionalInformations": document.getElementById("add-info").value,
|
"additionalInformations": document.getElementById("add-info").value,
|
||||||
"categotry": "cat1",
|
"categotry": "cat1",
|
||||||
"visibility": "TRUE"
|
"visibility": "TRUE"
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -82,7 +80,6 @@ function logoutVisibility() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loginVisibility() {
|
function loginVisibility() {
|
||||||
if (localStorage.getItem("token") !== null) {
|
if (localStorage.getItem("token") !== null) {
|
||||||
document.getElementById("login").style.display = "none";
|
document.getElementById("login").style.display = "none";
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Padel Tournaments System</title>
|
<title>Padel Tournaments System</title>
|
||||||
<link href="style.css" rel="stylesheet">
|
<link href="style.css" rel="stylesheet">
|
||||||
|
<script type="text/javascript" src="app.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body onload="logoutVisibility(); loginVisibility()">
|
<body onload="logoutVisibility(); loginVisibility()">
|
||||||
<script type="text/javascript" src="app.js"></script>
|
|
||||||
<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"
|
||||||
|
Loading…
Reference in New Issue
Block a user