API.fetch() method
A typed fetch handler for API requests.
Signature:
fetch<TData extends {} = any, TQuery extends Record<string, unknown> = {}, TParseAs extends FetchParseAs = FetchParseAs>(path: string, init?: FetchInit<TQuery, TParseAs>): Promise<FetchResult<TData, TParseAs>>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
path |
string | |
|
init |
FetchInit<TQuery, TParseAs> |
(Optional) |
Returns:
Promise<FetchResult<TData, TParseAs>>
Remarks
This handler will throw an APIError on 4xx and 5xx status codes.