fix: resolve TypeScript error in apiFetch headers
fix: resolve TypeScript error in apiFetch headers
This commit is contained in:
commit
8cfae110c8
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 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), {
|
const response = await fetch(buildUrl(path), {
|
||||||
...rest,
|
...rest,
|
||||||
headers: {
|
headers: {
|
||||||
...contentTypeHeader,
|
...defaultHeaders,
|
||||||
...authHeader,
|
...authHeader,
|
||||||
...headers,
|
...headers,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue