Compare commits

..

5 Commits

Author SHA1 Message Date
31159ebb5c Merge pull request 'Fixing the cross origine on the frontend side + request in json' (#79) from tonitch/front/fix/crossOrigine into master
All checks were successful
Build and test backend / Build-backend (push) Successful in 2m15s
Build and test backend / Test-backend (push) Successful in 1m22s
deploy to production / deploy-frontend (push) Successful in 26s
deploy to production / deploy-backend (push) Successful in 2m23s
Build and test FrontEnd / Build-frontend (push) Successful in 23s
Reviewed-on: #79
Reviewed-by: Maxime <231026@umons.ac.be>
2024-03-09 18:18:15 +01:00
ac88307036 fix expiration date and frontend requests
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 2m1s
Build and test backend / Test-backend (pull_request) Successful in 2m1s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 25s
2024-03-09 16:22:38 +01:00
847b1ca419 Solve crossOrigin Finally
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 2m2s
Build and test backend / Test-backend (pull_request) Successful in 2m0s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 24s
2024-03-09 16:20:55 +01:00
0b4b38f6c5 Fix typo
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 2m1s
Build and test backend / Test-backend (pull_request) Successful in 1m56s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 23s
Merci javascript pour ces erreurs de qualitée...
2024-03-09 10:36:20 +01:00
21de520175 Fixing the cross origine on the frontend side
Some checks failed
Build and test backend / Build-backend (pull_request) Successful in 1m59s
Build and test backend / Test-backend (pull_request) Successful in 1m59s
Build and test FrontEnd / Build-frontend (pull_request) Failing after 21s
2024-03-09 10:29:32 +01:00
3 changed files with 9 additions and 6 deletions

View File

@ -9,7 +9,7 @@ import ovh.herisson.Clyde.Services.AuthenticatorService;
import java.util.Date;
@RestController
@CrossOrigin(origins = "http://localhost:5173")
@CrossOrigin(origins = "http://localhost:5173", allowCredentials = "true")
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", {login: user, password: pass, expiration: exp});
return restPost("/login", {identifier: user, password: pass, expirationDate: 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", body: 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: 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: data});
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
}
/**
@ -31,7 +31,10 @@ 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});
let headers = new Headers({
'Authorization': session_token,
'Content-Type': 'application/json',
});
config['headers'] = headers;
return toast.promise(fetch(restURL + endPoint, config),
{