feat: ✨ adding api
adding api connection to registration and tournament making
This commit is contained in:
parent
5462828aba
commit
f7cd8783be
13
frontend/dodawanie turnieju/app.js
Normal file
13
frontend/dodawanie turnieju/app.js
Normal file
@ -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 + '"}');
|
||||||
|
});
|
@ -12,7 +12,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<div class="logoBox">
|
<div class="logoBox">
|
||||||
<a class="header_link" href="../index.html"><img class="logo" src="../_global/logo.svg" alt="Logo error"></a>
|
<a class="header_link" href="../index.html"><img class="logo" src="../_global/logo.svg"
|
||||||
|
alt="Logo error"></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="linkBox">
|
<div class="linkBox">
|
||||||
<!-- <span class="dot">JM</span>-->
|
<!-- <span class="dot">JM</span>-->
|
||||||
@ -31,7 +32,7 @@
|
|||||||
<div class="form">
|
<div class="form">
|
||||||
<h3 class="descriptor">Nazwa Turnieju</h3>
|
<h3 class="descriptor">Nazwa Turnieju</h3>
|
||||||
<label>
|
<label>
|
||||||
<input>
|
<input id="tournamentName">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<h3 class="descriptor">Termin</h3>
|
<h3 class="descriptor">Termin</h3>
|
||||||
@ -41,17 +42,17 @@
|
|||||||
|
|
||||||
<h3 class="descriptor">Miejsce</h3>
|
<h3 class="descriptor">Miejsce</h3>
|
||||||
<label>
|
<label>
|
||||||
<input>
|
<input id="tournamentPlace">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<h3 class="descriptor">Kategorie</h3>
|
<h3 class="descriptor">Kategorie</h3>
|
||||||
<label>
|
<label>
|
||||||
<input>
|
<input id="ladderType">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<h3 class="descriptor">Ranga</h3>
|
<h3 class="descriptor">Ranga</h3>
|
||||||
<label>
|
<label>
|
||||||
<input>
|
<input id="isRanked">
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<h3 class="descriptor">Wpisowe</h3>
|
<h3 class="descriptor">Wpisowe</h3>
|
||||||
@ -82,6 +83,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript" src="app.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
18
frontend/logowanie/app.js
Normal file
18
frontend/logowanie/app.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
document.getElementById("loginsubmit").addEventListener("click", function () {
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.onreadystatechange = function () {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
alert("logged in");
|
||||||
|
console.log("dziala");
|
||||||
|
} else if (this.readyState == 4) {
|
||||||
|
alert("something not work :( " + this.status);
|
||||||
|
console.log("nie dziala");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhttp.open("POST", "https://dragonmaster.pl/inz/user/login");
|
||||||
|
xhttp.send('{"username":"' + document.getElementById("loginusername").value + '","password":"' + document.getElementById("loginpassword").value + '"}');
|
||||||
|
});
|
||||||
|
|
||||||
|
function submit() {
|
||||||
|
("form").submit(function () { return false; })
|
||||||
|
}
|
@ -14,14 +14,16 @@
|
|||||||
<div class="form">
|
<div class="form">
|
||||||
<div class="login">
|
<div class="login">
|
||||||
<h2>Logowanie</h2>
|
<h2>Logowanie</h2>
|
||||||
<input placeholder="Tutaj wpisz email lub nick">
|
<input placeholder="Tutaj wpisz email lub nick" id="loginusername">
|
||||||
|
|
||||||
<input placeholder="Tutaj wpisz hasło">
|
<input placeholder="Tutaj wpisz hasło" id="loginpassword">
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<form action="../zalogowany_organizator/index.html">
|
<!-- trzeba dać cssy buttonowi bo zmieniłem z form na button -->
|
||||||
<input class="myButton" type="submit" value="Zaloguj" />
|
<button>
|
||||||
</form>
|
<input class="myButton" type="submit" value="Zaloguj" id="loginsubmit" />
|
||||||
|
|
||||||
|
</button>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a href="#">Zapomniałeś hasła?</a>
|
<a href="#">Zapomniałeś hasła?</a>
|
||||||
@ -31,6 +33,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript" src="app.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -17,56 +17,6 @@ form.addEventListener('submit', function (e) {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
// <<<<<<< HEAD
|
|
||||||
// var token = "";
|
|
||||||
// // document.getElementById("loginButton").addEventListener("click", function () {
|
|
||||||
// // document.getElementById("login").style.display = "block";
|
|
||||||
// // });
|
|
||||||
// // =======
|
|
||||||
// //REST API
|
|
||||||
// var token = "";
|
|
||||||
// document.getElementById("loginButton").addEventListener("click", function () {
|
|
||||||
// document.getElementById("login").style.display = "block";
|
|
||||||
// });
|
|
||||||
// >>>>>>> b44b5f1fc14af7c8da4ca602072af953974b49af
|
|
||||||
|
|
||||||
// // document.getElementById("regButton").addEventListener("click", function () {
|
|
||||||
// // document.getElementById("reg").style.display = "block";
|
|
||||||
// // });
|
|
||||||
// document.getElementById("registrationButton").addEventListener("click", function () {
|
|
||||||
// document.getElementById("registration").style.display = "block";
|
|
||||||
// });
|
|
||||||
// document.getElementById("checkPaymentButton").addEventListener("click", function () {
|
|
||||||
// document.getElementById("checkStatus").style.display = "block";
|
|
||||||
// });
|
|
||||||
// var registartions = [];
|
|
||||||
// document.getElementById("getRegistartionsButton").addEventListener("click", function () {
|
|
||||||
// document.getElementById("getRegistartions").style.display = "block";
|
|
||||||
// });
|
|
||||||
// document.getElementById("getUserDataButton").addEventListener("click", function () {
|
|
||||||
// var xhttp = new XMLHttpRequest();
|
|
||||||
// xhttp.onreadystatechange = function () {
|
|
||||||
// if (this.readyState == 4 && this.status == 200) {
|
|
||||||
// var json = JSON.parse(this.response);
|
|
||||||
// document.getElementById("getUserDataid").innerText = json.id;
|
|
||||||
// document.getElementById("getUserDataname").innerText = json.name;
|
|
||||||
// document.getElementById("getUserDatasurname").innerText = json.surname;
|
|
||||||
// document.getElementById("getUserDatarole").innerText = json.role;
|
|
||||||
// document.getElementById("getUserDatalogin").innerText = json.login;
|
|
||||||
// document.getElementById("getUserDataphone").innerText = json.phone;
|
|
||||||
// document.getElementById("getUserDatamail").innerText = json.mail;
|
|
||||||
// document.getElementById("getUserData").style.display = "block";
|
|
||||||
// } else if (this.readyState == 4) {
|
|
||||||
// alert("something not work :( " + this.status);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// xhttp.open("GET", "dragonmaster.pl/inz/user");
|
|
||||||
// xhttp.setRequestHeader("Authorization", "Bearer " + token);
|
|
||||||
// xhttp.send();
|
|
||||||
// });
|
|
||||||
// document.getElementById("updateUserDataButton").addEventListener("click", function () {
|
|
||||||
// document.getElementById("updateUserData").style.display = "block";
|
|
||||||
// });
|
|
||||||
document.getElementById("regsubmit").addEventListener("click", function () {
|
document.getElementById("regsubmit").addEventListener("click", function () {
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
xhttp.onreadystatechange = function () {
|
xhttp.onreadystatechange = function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user