63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
let tourId = localStorage.getItem("myElement")
|
|
|
|
async function showTournaments() {
|
|
let url = 'https://dragonmaster.pl/inz/tournaments';
|
|
try {
|
|
let res = await fetch(url);
|
|
return await res.json();
|
|
} catch (error) {
|
|
console.log(error);
|
|
}
|
|
}
|
|
|
|
async function renderTournaments() {
|
|
let tournaments = await showTournaments();
|
|
let html = '';
|
|
let htmlDate = '';
|
|
tournaments.forEach(tournament => {
|
|
if (`${tournament.id}` == localStorage.getItem("tournamentId")) {
|
|
|
|
htmlDate = `
|
|
<h1 class="tournamentInfo">${tournament.name}</h1>
|
|
<h2 class="tournamentInfo">${tournament.places}</br>
|
|
${tournament.from} do ${tournament.to}</h2>`
|
|
|
|
|
|
|
|
let htmlSegment = `
|
|
<h1> ${tournament.name}</h1>
|
|
<h2>${tournament.places}</h2>
|
|
|
|
<h3 class="descriptor">Wpisowe:</h3>
|
|
${tournament.entryFee}
|
|
|
|
<h3 class="descriptor">Ranga:</h3>
|
|
${tournament.rang}
|
|
|
|
<h3 class="descriptor">Kategorie:</h3>
|
|
${tournament.categotry}
|
|
|
|
<h3 class="descriptor">Zapisy do:</h3>
|
|
${tournament.to}
|
|
|
|
<h3 class="descriptor">Czy rankingowy:</h3>
|
|
${tournament.rang}
|
|
|
|
<h3 class="descriptor">Dyrektor turnieju:</h3>
|
|
${tournament.director}
|
|
|
|
<h3 class="descriptor">Dodatkowe informacje</h3>
|
|
${tournament.additionalInformations}
|
|
|
|
`;
|
|
html += htmlSegment;
|
|
}
|
|
});
|
|
|
|
let date = document.querySelector('.tournamentData')
|
|
date.innerHTML = htmlDate;
|
|
|
|
let container = document.querySelector('.form');
|
|
container.innerHTML = html;
|
|
}
|