2024-03-13 22:28:59 +01:00
|
|
|
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]);
|
2024-03-29 10:55:59 +01:00
|
|
|
|
|
|
|
return restPostFile("/upload/ProfilePicture", formData);
|
2024-03-13 22:28:59 +01:00
|
|
|
}
|
2024-03-29 10:55:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
}
|