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 = ''; // tournaments[1]; (tournament => { // let htmlSegment = `

${tournament.id}

`; // html += htmlSegment; // }); // let container = document.querySelector('.form'); // container.innerHTML = html; // } async function renderTournaments() { let tournaments = await showTournaments(); 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; }