H5: admin-scherm voor de hero (formulier, slides, upload, focus-editor met voorbeeld, TypeScript-tweeling van FocusMath)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -129,7 +129,9 @@ export class ApiClient {
|
||||
const { body, skipAuthRefresh: _skip, headers, ...rest } = options;
|
||||
const finalHeaders = new Headers(headers);
|
||||
|
||||
if (body !== undefined && body !== null) {
|
||||
// A FormData body (file upload) is sent as is: the browser sets the multipart content type and boundary.
|
||||
const isForm = typeof FormData !== 'undefined' && body instanceof FormData;
|
||||
if (body !== undefined && body !== null && !isForm) {
|
||||
finalHeaders.set('Content-Type', 'application/json');
|
||||
}
|
||||
if (this.accessToken !== null) {
|
||||
@@ -143,7 +145,7 @@ export class ApiClient {
|
||||
credentials: 'include',
|
||||
// A list read after a change must come from the server, never from an intermediate cache.
|
||||
...(rest.method === 'GET' ? { cache: 'no-store' as const } : {}),
|
||||
body: body !== undefined && body !== null ? JSON.stringify(body) : undefined,
|
||||
body: body !== undefined && body !== null ? (isForm ? (body as FormData) : JSON.stringify(body)) : undefined,
|
||||
});
|
||||
} catch (cause) {
|
||||
throw new NetworkError(cause instanceof Error ? cause.message : undefined);
|
||||
|
||||
Reference in New Issue
Block a user