Přeskočit na hlavní obsah

Module: hooks/useSmartFetch

Type Aliases

BaseState

Ƭ BaseState: Object

Type declaration

NameType
refetch() => Promise<void>

Defined in

src/web-app/src/hooks/useSmartFetch.tsx:5


ErrorState

Ƭ ErrorState<TError>: BaseState & { data: null ; error: TError ; isError: true ; isLoading: false ; status: "error" }

Type parameters

Name
TError

Defined in

src/web-app/src/hooks/useSmartFetch.tsx:25


LoadingState

Ƭ LoadingState: BaseState & { data: null ; error: null ; isError: false ; isLoading: true ; status: "loading" }

Defined in

src/web-app/src/hooks/useSmartFetch.tsx:9


SmartFetchState

Ƭ SmartFetchState<TData, TError>: LoadingState | SuccessState<TData> | ErrorState<TError>

Type parameters

Name
TData
TError

Defined in

src/web-app/src/hooks/useSmartFetch.tsx:33


SuccessState

Ƭ SuccessState<TData>: BaseState & { data: TData ; error: null ; isError: false ; isLoading: false ; status: "success" }

Type parameters

Name
TData

Defined in

src/web-app/src/hooks/useSmartFetch.tsx:17

Functions

useSmartFetch

useSmartFetch<TData, TError>(root0): SmartFetchState<TData, TError>

Simple hook for fetching data once.

Type parameters

NameType
TDataTData
TErrorunknown

Parameters

NameTypeDefault valueDescription
root0ObjectundefinedOptions object.
root0.enabled?booleantrueWhether the query should be executed.
root0.queryFn() => Promise<TData>undefinedQuery function to wrap with smart fetch.

Returns

SmartFetchState<TData, TError>

Defined in

src/web-app/src/hooks/useSmartFetch.tsx:44