Skip to content
Snippets Groups Projects
Commit 4dfc990c authored by Bernard Roland (Student Com20)'s avatar Bernard Roland (Student Com20)
Browse files

Fixed the image upload adapter

parent d7222cf5
No related branches found
No related tags found
No related merge requests found
...@@ -22,13 +22,15 @@ async function executeApiRequest<T>(path: string, method: string, body: any, onS ...@@ -22,13 +22,15 @@ async function executeApiRequest<T>(path: string, method: string, body: any, onS
method: method, method: method,
headers: { headers: {
...getAuthHeader(), ...getAuthHeader(),
...(body ? ( ...(body && !(body instanceof FormData)
body instanceof FormData ? { 'Content-Type': 'application/json' }
? { 'Content-Type': 'multipart/form-data' }
: { 'Content-Type': 'application/json' })
: { }), : { }),
}, },
body: body ? JSON.stringify(body) : undefined, body: body
? (body instanceof FormData
? body
: JSON.stringify(body))
: undefined,
}); });
if (response.ok) { if (response.ok) {
return onSuccess(await response.json()); return onSuccess(await response.json());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment