nouvelle page html

This commit is contained in:
Valentin CZERYBA 2022-07-21 00:19:46 +02:00
parent cfbf0d7471
commit 854b8250d3
2 changed files with 12 additions and 5 deletions

9
web/html/home.html Normal file
View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>Coucou</title>
</head>
<body>
<p>Bienvenue</p>
</body>
</html>

View File

@ -1,5 +1,5 @@
instance.get("token", { withCredentials: true}) instance.get("token", { withCredentials: true})
.then(function(response) { console.log(response) }) .then(function(response) { location.href="html/home.html"; })
.catch(function(error){ .catch(function(error){
}); });
@ -9,9 +9,8 @@ document.getElementById("signin").addEventListener("submit", function(evt){
var pseudo = document.getElementById("floatingPseudo"); var pseudo = document.getElementById("floatingPseudo");
var password = document.getElementById("floatingPassword"); var password = document.getElementById("floatingPassword");
if((password.value.length > 0) || (pseudo.value.length > 0)){ if((password.value.length > 0) || (pseudo.value.length > 0)){
console.log(pseudo.value);
instance.get("token", { auth : {username: pseudo.value, password: password.value}, withCredentials: true}) instance.get("token", { auth : {username: pseudo.value, password: password.value}, withCredentials: true})
.then(function(response) { console.log(response) }) .then(function(response) { location.href="html/home.html"; })
.catch(function(error){ .catch(function(error){
switch (error.response.status){ switch (error.response.status){
@ -30,8 +29,7 @@ document.getElementById("signin").addEventListener("submit", function(evt){
default: default:
id = "alertUnknown"; id = "alertUnknown";
break; break;
} }
document.getElementById(id).classList.remove("hidden"); document.getElementById(id).classList.remove("hidden");
}); });