1
0
forked from PGL/Clyde

modifying the frontend to send the image and getting the data

This commit is contained in:
2024-03-13 22:30:42 +01:00
parent a0285e700d
commit 64e7f8dc6b
6 changed files with 15 additions and 2 deletions

View File

@ -11,6 +11,11 @@ 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 });
}
export async function restDelete(endPoint, data) {
return await _rest(endPoint, {method: "DELETE", credentials: 'include', body: JSON.stringify(data)});
}
@ -35,7 +40,7 @@ async function _rest(endPoint, config){
'Authorization': session_token,
'Content-Type': 'application/json',
});
config['headers'] = headers;
config['headers'] = config['headers'] == null ? headers : config['headers'];
return toast.promise(fetch(restURL + endPoint, config),
{
pending: config['pending'] != null ? config['pending'] : 'pending',