Interface: UseApiReturn<T>
Defined in: use-api.ts:49
The return type of the useApi hook.
Type Parameters
T
T
The type of data expected in the response.
Properties
data
data:
T|null
Defined in: use-api.ts:51
The fetched data, or null if there’s no data yet.
error
error:
Error|null
Defined in: use-api.ts:59
The error if the request failed, or null if no error occurred. Non-2xx
responses are reported as an ApiError with the status and
response; other failures (network, JSON parsing) as the thrown Error.
loading
loading:
boolean
Defined in: use-api.ts:53
Indicates whether the request is currently being processed.
refetch
refetch: () =>
Promise<void>
Defined in: use-api.ts:61
Function to manually refetch the data.
Returns
Promise<void>