fix: resolve TypeScript error in apiFetch headers

Type the defaultHeaders as Record<string, string> to fix TS2322 error
when spreading headers into fetch options.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gabriel Santana de Menezes 2026-05-21 19:17:41 -04:00
parent 39ed29c0c4
commit 2a41e5cf86

View file

@ -22,12 +22,12 @@ export async function apiFetch<T>(path: string, options: RequestOptions = {}) {
}
const isFormData = body instanceof FormData
const contentTypeHeader = isFormData ? {} : { 'Content-Type': 'application/json' }
const defaultHeaders: Record<string, string> = isFormData ? {} : { 'Content-Type': 'application/json' }
const response = await fetch(buildUrl(path), {
...rest,
headers: {
...contentTypeHeader,
...defaultHeaders,
...authHeader,
...headers,
},