diff --git a/src/client.js b/src/client.js index ba20b3b..0f85f7e 100644 --- a/src/client.js +++ b/src/client.js @@ -156,6 +156,7 @@ export class ApiClient { staleTime = this.config.staleTime, headers, hydrate, + fetch, } = config const query = this.getQuery(queryArg) @@ -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 @@ -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() })