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
23 lines
528 B
JavaScript
23 lines
528 B
JavaScript
import { restPostFile } from '@/rest/restConsumer.js'
|
|
|
|
|
|
/**
|
|
* Upload a file to the server and return the url of this image
|
|
*/
|
|
export async function uploadProfilePicture(file){
|
|
const formData = new FormData();
|
|
formData.append("file", file[0]);
|
|
|
|
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)
|
|
} |