mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 16:46:00 +00:00
modify MediaApi to support custom fetch implementation, defaults to native fetch (#158)
* modify MediaApi to support custom fetch implementation, defaults to native fetch added an optional `fetcher` parameter to allow usage of a custom fetch function in both `upload` and `fetcher` methods. Defaults to the standard `fetch` if none is provided. * fix tests and improve api fetcher types
This commit is contained in:
+6
-1
@@ -8,6 +8,11 @@ import { omitKeys } from "core/utils";
|
||||
|
||||
export type TApiUser = SafeUser;
|
||||
|
||||
export type ApiFetcher = (
|
||||
input: RequestInfo | URL,
|
||||
init?: RequestInit,
|
||||
) => Response | Promise<Response>;
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__BKND__: {
|
||||
@@ -21,7 +26,7 @@ export type ApiOptions = {
|
||||
headers?: Headers;
|
||||
key?: string;
|
||||
localStorage?: boolean;
|
||||
fetcher?: typeof fetch;
|
||||
fetcher?: ApiFetcher;
|
||||
verbose?: boolean;
|
||||
verified?: boolean;
|
||||
} & (
|
||||
|
||||
Reference in New Issue
Block a user