Skip to main content
Version: 0.1.2

Interface: FetchStateRequest

Imported from @react-logic/utils

The full request descriptor a build callback may return — same as FetchStateConfig plus a required url. Either both helpers' callbacks return this object, or a bare URL string as a shorthand for { url }.

Type Parameters

T

T = unknown

The parsed response type.

Properties

body?

optional body?: FetchStateBody

Plain objects/arrays are JSON-stringified; BodyInit values pass through untouched.


fetcher?

optional fetcher?: FetchAdapter

Per-call HTTP adapter, overriding the global one set via setFetchStateAdapter.


parse?

optional parse?: (response) => Promise<T>

How to turn the response into the value. Defaults to a function that throws when !ok and returns r.json() as T otherwise. Throw inside parse to land in the failed state with that error and the response's status.

Parameters

Returns

Promise<T>


url

url: string