Fix the profilepicture url issue (it wasn't sent to the db)

add a prototype of a more generic uploadfile function in uploads.js

makes the distinction between a master cursus and a bachelor cursus in display
This commit is contained in:
2024-03-29 10:55:59 +01:00
parent 94f12f0a86
commit a3c9d6a7c0
6 changed files with 46 additions and 14 deletions

View File

@ -26,7 +26,7 @@ export function disconnect(){
* @param curriculum
* @param imageId id of the image in database returned when uploaded
*/
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId){
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId, identityCardId, submissionDate){
return restPost("/register", {
firstName: firstname,
lastName: lastname,
@ -36,7 +36,9 @@ export async function register(firstname, lastname, birthDate, password, email,
address: address,
country: country,
curriculumId: curriculumId,
profilePictureUrl: imageId,
profilePicture: imageId,
identityCard : identityCardId,
submissionDate : submissionDate
});
}
@ -52,7 +54,7 @@ export async function register(firstname, lastname, birthDate, password, email,
* @param country
* @param imageId id of the image in database returned when uploaded
*
* PS: the password is not is not required as it is generated by the backend and sent to the user
* PS: the password is not required as it is generated by the backend and sent to the user
* by mail. it's up to the user to change it if he cares about security
*/
export async function createUser(firstname, lastname, birthDate, email, address, country, role, imageId){

View File

@ -7,5 +7,17 @@ import { restPostFile } from '@/rest/restConsumer.js'
export async function uploadProfilePicture(file){
const formData = new FormData();
formData.append("file", file[0]);
return restPostFile("/upload/ProfilePicture", formData)
return restPostFile("/upload/ProfilePicture", formData);
}
/**
* More generic version of the upload method
*/
export async function uploadFile(file, type){
const formData = new FormData();
formData.append("file", file[0]);
return restPostFile("/upload/"+type, formData)
}