Login and register ok and starting requests

This commit is contained in:
2024-03-18 11:55:51 +01:00
parent 8ff29ca34e
commit 753af3874e
13 changed files with 42 additions and 33 deletions

View File

@ -3,7 +3,7 @@
*
* TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future.
*/
import {restGet, restPatch} from './restConsumer.js'
import {restGet, restPatch,restPatchInfo} from './restConsumer.js'
/**
* create a new register requests that can be recovered by the registering service
@ -41,5 +41,5 @@ export async function getAllRegisters(){
* Change the state of a requests.
*/
export async function validateRegister(id, state){
return restPatch("/request/register/" + id, {state: state});
return restPatch("/request/register/" + id, state);
}

View File

@ -28,14 +28,15 @@ export function disconnect(){
*/
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId){
return restPost("/register", {
firstname: firstname,
lastname: lastname,
firstName: firstname,
lastName: lastname,
birthDate: birthDate,
password: password,
email: email,
address: address,
country: country,
curriculumId: curriculumId
curriculumId: curriculumId,
profilePictureUrl: imageId,
});
}

View File

@ -11,6 +11,7 @@ export async function restPost(endPoint, data) {
return await _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)});
}
export async function restPostFile(endPoint, file){
let headers = new Headers();
return await _rest(endPoint, {method: "POST", credentials: 'include', body: file, headers: headers });
@ -24,6 +25,10 @@ export async function restPatch(endPoint, data) {
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
}
export async function restPatchInfo(endPoint, data){
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: data});
}
/**
* backbone for the request made by the frontend
*