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); } } function loginVisibility() { if (localStorage.getItem("token") !== null) { document.getElementById("login").style.display = "none"; } else { document.getElementById("login").style.display = ""; } } async function renderTournaments() { let tournaments = await showTournaments(); let html = ''; let htmlDate = ''; tournaments.forEach(tournament => { let rank = 0 if (`${tournament.approved}` == 0) { rank = "Nie" } else if (`${tournament.approved}` == 1) { rank = "Tak, ale niezatwierdzony" } else { rank = "Tak" } if (`${tournament.id}` == localStorage.getItem("tournamentId")) { console.log(`${tournament.rang}`) htmlDate = `