headers-api-everywhere: Add headers to all api calls
This commit is contained in:
parent
788d6c9c1f
commit
95a4d9f357
14
src/libs/fetcher.ts
Normal file
14
src/libs/fetcher.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { getCustomOllamaHeaders } from "@/services/app"
|
||||||
|
|
||||||
|
|
||||||
|
const fetcher = async (input: string | URL | globalThis.Request, init?: RequestInit) : Promise<Response> => {
|
||||||
|
const update = {...init} || {}
|
||||||
|
const customHeaders = await getCustomOllamaHeaders()
|
||||||
|
update.headers = {
|
||||||
|
...customHeaders,
|
||||||
|
...update?.headers
|
||||||
|
}
|
||||||
|
return fetch(input, update)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default fetcher
|
Loading…
x
Reference in New Issue
Block a user