1
0
forked from PGL/Clyde
Clyde/frontend/src/rest/uploads.js
2024-04-20 12:42:41 +02:00

24 lines
543 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 uploadProfilePicture method
*/
export async function uploadFile(file, type){
const formData = new FormData();
formData.append("file", file[0]);
return restPostFile("/upload/"+type, formData)
}