diff --git a/frontend/dodawanie turnieju/app.js b/frontend/dodawanie turnieju/app.js new file mode 100644 index 0000000..1a47f50 --- /dev/null +++ b/frontend/dodawanie turnieju/app.js @@ -0,0 +1,13 @@ +document.getElementById("tournamentSubmit").addEventListener("click", function () { + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function () { + if (this.readyState == 4 && this.status == 200) { + alert("Dodano turniej"); + } else if (this.readyState == 4) { + alert("something not work :( " + this.status); + } + } + xhttp.open("PUT", "dragonmaster.pl/inz/tournament"); + xhttp.setRequestHeader("Authorization", "Bearer " + token); + xhttp.send('{"name":"' + document.getElementById("tournamentName").value + '","typeOfLadder":"' + document.getElementById("ladderType").value + '","pointsForTournament":"' + document.getElementById("tournamentPoints").value + '","places":"' + document.getElementById("tournamentPlace").value + '","roles":"' + document.getElementById("tournamentRole").value + '","ranked":"' + document.getElementById("isRanked").value + '"}'); +}); \ No newline at end of file diff --git a/frontend/dodawanie turnieju/index.html b/frontend/dodawanie turnieju/index.html index 23c4a97..0833b50 100644 --- a/frontend/dodawanie turnieju/index.html +++ b/frontend/dodawanie turnieju/index.html @@ -12,18 +12,19 @@