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:
parent
39ed29c0c4
commit
2a41e5cf86
1 changed files with 2 additions and 2 deletions
|
|
@ -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,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue