Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export class ApiClient {
staleTime = this.config.staleTime,
headers,
hydrate,
fetch,
} = config

const query = this.getQuery(queryArg)
Expand Down Expand Up @@ -190,7 +191,7 @@ export class ApiClient {
isFetching: true,
})

const request = this.request(query.url, { headers })
const request = this.request(query.url, { headers, fetch })

query.promise = (async () => {
query.cache = await request
Expand Down Expand Up @@ -366,8 +367,10 @@ export class ApiClient {
abort = () => controller.abort()
}

const promise = this.config
.fetch(uri, options)
const fetchFn = options.fetch || this.config.fetch;
delete options.fetch;

const promise = fetchFn(uri, options)
.then(res => {
return res.status === 204 ? {} : res.json()
})
Expand Down