API/QubeeFetcher
QubeeFetcher
typesrc/types/qubee-fetcher.type.ts
The function the fetching APIs call to perform a request. It has the shape of fetch, so the
global fetch fits, and so does a wrapper that adds an Authorization header or a client
such as ky.
It receives the request’s address, the headers the driver wants on it, and the signal that
aborts it. A response whose status is not ok becomes a QubeeFetchError.
Import
Section titled “Import”import type { QubeeFetcher } from '@qubeejs/react';import type { QubeeFetcher } from '@qubeejs/react/fetch';The entries export the same thing: import it from whichever the file already uses.
Definition
Section titled “Definition”type QubeeFetcher = (uri: string, init: { … }) => Promise<Response>Example
Section titled “Example”const authFetch: QubeeFetcher = (uri, init) => fetch(uri, { ...init, headers: { ...init.headers, Authorization: `Bearer ${token()}` } });