From ac8830703698f317bdf5ec3972722d36d4efd7fc Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Sat, 9 Mar 2024 16:22:38 +0100 Subject: [PATCH] fix expiration date and frontend requests --- frontend/src/rest/Users.js | 2 +- frontend/src/rest/restConsumer.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/src/rest/Users.js b/frontend/src/rest/Users.js index bcbf8b9..cca662d 100644 --- a/frontend/src/rest/Users.js +++ b/frontend/src/rest/Users.js @@ -1,7 +1,7 @@ import { restGet, restPost } from './restConsumer.js' export async function login(user, pass, exp){ - return restPost("/login", {identifier: user, password: pass, expiration: exp}); + return restPost("/login", {identifier: user, password: pass, expirationDate: exp}); } export async function register(user, pass, mail){ diff --git a/frontend/src/rest/restConsumer.js b/frontend/src/rest/restConsumer.js index 9e42e49..b2d1546 100644 --- a/frontend/src/rest/restConsumer.js +++ b/frontend/src/rest/restConsumer.js @@ -8,15 +8,15 @@ export async function restGet(endPoint) { } export async function restPost(endPoint, data) { - return await _rest(endPoint, {method: "POST", body: JSON.stringify(data)}); + return await _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)}); } export async function restDelete(endPoint, data) { - return await _rest(endPoint, {method: "DELETE", body: JSON.stringify(data)}); + return await _rest(endPoint, {method: "DELETE", credentials: 'include', body: JSON.stringify(data)}); } export async function restPatch(endPoint, data) { - return await _rest(endPoint, {method: "PATCH", body: JSON.stringify(data)}); + return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)}); } /** @@ -36,7 +36,6 @@ async function _rest(endPoint, config){ 'Content-Type': 'application/json', }); config['headers'] = headers; - config['credentials'] = 'include' return toast.promise(fetch(restURL + endPoint, config), { pending: config['pending'] != null ? config['pending'] : 'pending',