var coll = document.getElementsByClassName("collapsible"); var i; for (i = 0; i < coll.length; i++) { coll[i].addEventListener("click", function () { this.classList.toggle("active"); var content = this.nextElementSibling; if (content.style.maxHeight) { content.style.maxHeight = null; } else { content.style.maxHeight = content.scrollHeight + "px"; } }); } function acceptPlayers(id) { console.log(id) const requestOptions = { method: 'POST', headers: { 'Authorization': ("Bearer " + localStorage.getItem("token")) }, body: JSON.stringify({ title: id }) }; fetch('https://dragonmaster.pl/inz_swag/registration/payedUsingCash', requestOptions) .then(response => response.json()) .then(data => console.log("ok")); } // GET request using fetch with set headers function registrationsGet() { let id = localStorage.getItem('tournamentId'); const element = document.getElementById('tournament8'); const headers = { 'Authorization': ("Bearer " + localStorage.getItem("token")) }; fetch('https://dragonmaster.pl/inz/registrations' + '?id=' + id, { headers }) .then(response => response.json()) .then(data => element.innerHTML = data.map(dataItem => `
${dataItem.userid} ${dataItem.paymenttype} ${dataItem.paymentstatus} ${dataItem.partner}
`) ); }