From 326b21a65c9492d9e358845a9133b9f12b2633e5 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Fri, 20 Oct 2023 22:24:13 +0200 Subject: [PATCH] integ webcredentials --- web/js/config.js | 2 +- web/js/login.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/web/js/config.js b/web/js/config.js index 8094a66..8200117 100644 --- a/web/js/config.js +++ b/web/js/config.js @@ -1 +1 @@ -const instance = axios.create({ baseURL: 'http://localhost:8083'}); \ No newline at end of file +const instance = axios.create({ baseURL: 'http://localhost:8083', withCredentials: true}); \ No newline at end of file diff --git a/web/js/login.js b/web/js/login.js index 4f312a5..9fb6a49 100644 --- a/web/js/login.js +++ b/web/js/login.js @@ -7,8 +7,9 @@ document.getElementById("signin").addEventListener("submit", function(evt){ var password = document.getElementById("floatingPassword"); if((password.value.length > 0) || (pseudo.value.length > 0)){ 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"; }) + instance.post("token", {username: pseudo.value, password: password.value}, {headers: {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' }}) + .then(function(response) { + location.href="html/users.html"; }) .catch(function(error){ switch (error.response.status){