update token

This commit is contained in:
Valentin CZERYBA 2023-10-19 00:00:15 +02:00
parent e026d9bd04
commit 1bc043dd5e
2 changed files with 3 additions and 2 deletions

View File

@ -1 +1 @@
const instance = axios.create({ baseURL: 'http://localhost:8083/api'}); const instance = axios.create({ baseURL: 'http://localhost:8083'});

View File

@ -6,7 +6,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)){
instance.get("token", { auth : {username: pseudo.value, password: password.value}, withCredentials: true}) authData = {username: pseudo.value, password: password.value}
instance.post("token", {username: pseudo.value, password: password.value}, {headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' }}, { withCredentials: true})
.then(function(response) { location.href="html/users.html"; }) .then(function(response) { location.href="html/users.html"; })
.catch(function(error){ .catch(function(error){