Fixing the cross origine on the frontend side + request in json #79

Merged
tonitch merged 4 commits from tonitch/front/fix/crossOrigine into master 2024-03-09 18:18:16 +01:00
2 changed files with 4 additions and 5 deletions
Showing only changes of commit ac88307036 - Show all commits

View File

@ -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});
tonitch marked this conversation as resolved Outdated

expirationDate sur le backend

expirationDate sur le backend

Pourquoi tho, Je peux pas expirer en une heure ?

Pourquoi tho, Je peux pas expirer en une heure ?
}
export async function register(user, pass, mail){

View File

@ -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',