Compare commits

..

No commits in common. "31159ebb5c1dd04745b71786fc74b10f712728d6" and "5bda05925c39107dd9403248241ec13c1e0cb40f" have entirely different histories.

3 changed files with 6 additions and 9 deletions

View File

@ -9,7 +9,7 @@ import ovh.herisson.Clyde.Services.AuthenticatorService;
import java.util.Date;
@RestController
@CrossOrigin(origins = "http://localhost:5173", allowCredentials = "true")
@CrossOrigin(origins = "http://localhost:5173")
public class LoginController {
private final AuthenticatorService authServ;

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, expirationDate: exp});
return restPost("/login", {login: user, password: pass, expiration: exp});
}
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", credentials: 'include', body: JSON.stringify(data)});
return await _rest(endPoint, {method: "POST", body: data});
}
export async function restDelete(endPoint, data) {
return await _rest(endPoint, {method: "DELETE", credentials: 'include', body: JSON.stringify(data)});
return await _rest(endPoint, {method: "DELETE", body: data});
}
export async function restPatch(endPoint, data) {
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
return await _rest(endPoint, {method: "PATCH", body: data});
}
/**
@ -31,10 +31,7 @@ export async function restPatch(endPoint, data) {
async function _rest(endPoint, config){
endPoint.at(0) != "/" ? console.error("Carefull, you certainly should put a / at the begenning of your endPoint ") : true;
let session_token = getCookie("session_token");
let headers = new Headers({
'Authorization': session_token,
'Content-Type': 'application/json',
});
let headers = new Headers({'Authorization': session_token});
config['headers'] = headers;
return toast.promise(fetch(restURL + endPoint, config),
{