diff --git a/frontend/_main page/pojedynczy_turniej/app.js b/frontend/_main page/pojedynczy_turniej/app.js index ea49991..dd8b14d 100644 --- a/frontend/_main page/pojedynczy_turniej/app.js +++ b/frontend/_main page/pojedynczy_turniej/app.js @@ -1,4 +1,6 @@ -function showTournaments() { +let tourId = localStorage.getItem("myElement") + +async function showTournaments() { let url = 'https://dragonmaster.pl/inz/tournaments'; try { let res = await fetch(url); @@ -6,6 +8,55 @@ function showTournaments() { } catch (error) { console.log(error); } +} + +// async function renderTournaments() { +// let tournaments = await showTournaments(); +// let html = ''; +// tournaments[1]; (tournament => { +// let htmlSegment = `

${tournament.id}

`; +// html += htmlSegment; +// }); + +// let container = document.querySelector('.form'); +// container.innerHTML = html; +// } + +async function renderTournaments() { let tournaments = await showTournaments(); - console.log(tournaments[1]) -} \ No newline at end of file + let html = ''; + tournaments.forEach(tournament => { + if (`${tournament.id}` == localStorage.getItem("tournamentId")) { + let htmlSegment = ` +

${tournament.name}

+

${tournament.places}

+ +

Wpisowe:

+ ${tournament.entryFee} + +

Ranga:

+ ${tournament.rang} + +

Kategorie:

+ ${tournament.categotry} + +

Zapisy do:

+ ${tournament.to} + +

Czy rankingowy:

+ ${tournament.rang} + +

Dyrektor turnieju:

+ ${tournament.director} + +

Dodatkowe informacje

+ ${tournament.additionalInformations} + + `; + html += htmlSegment; + } + }); + + let container = document.querySelector('.form'); + container.innerHTML = html; +} diff --git a/frontend/_main page/pojedynczy_turniej/index.html b/frontend/_main page/pojedynczy_turniej/index.html index 7fd840f..7796167 100644 --- a/frontend/_main page/pojedynczy_turniej/index.html +++ b/frontend/_main page/pojedynczy_turniej/index.html @@ -7,16 +7,19 @@ Padel Tournaments System + - +
- +
diff --git a/frontend/app.js b/frontend/app.js index a119263..f9d9699 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -8,12 +8,15 @@ async function showTournaments() { } } +function saveIdTournament(id) { + localStorage.setItem('tournamentId', id); +} + async function renderTournaments() { let tournaments = await showTournaments(); let html = ''; - console.log(tournaments[1]) tournaments.forEach(tournament => { - let htmlSegment = `
+ let htmlSegment = `
diff --git a/frontend/index.html b/frontend/index.html index a63e53c..3cb42dd 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -10,7 +10,7 @@ - +