useStoreAsyncOperations
useStoreAsyncOperations<
TCode>(options):object
Defined in: hooks/useStoreAsyncOperations.ts:17
Composable for handling async operations in stores — consistent loading
states, error normalization via an injected ErrorCodeAdapter, and
operation execution. Generalized from the original app’s hook, which
hardcoded a NestJS-shaped ApiError/error-code enum directly.
Type Parameters
Section titled “Type Parameters”TCode extends string
Parameters
Section titled “Parameters”options
Section titled “options”UseStoreAsyncOperationsOptions<TCode>
Returns
Section titled “Returns”object
error:
ApiError<TCode> |null
executeOperation
Section titled “executeOperation”executeOperation: <
T>(operation,opts) =>Promise<T|undefined>
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”operation
Section titled “operation”() => Promise<T>
throwOnError?
Section titled “throwOnError?”boolean
Returns
Section titled “Returns”Promise<T | undefined>
fetchAllQuery
Section titled “fetchAllQuery”fetchAllQuery: (
newQuery) =>Record<string,unknown>
Parameters
Section titled “Parameters”newQuery
Section titled “newQuery”PaginationQuery
Returns
Section titled “Returns”Record<string, unknown>
handleApiError
Section titled “handleApiError”handleApiError: (
err,throwError) =>void
Parameters
Section titled “Parameters”unknown
throwError?
Section titled “throwError?”boolean = true
Returns
Section titled “Returns”void
loading
Section titled “loading”loading:
boolean
prepare
Section titled “prepare”prepare: () =>
void
Returns
Section titled “Returns”void
resetState
Section titled “resetState”resetState: () =>
void
Returns
Section titled “Returns”void
withAsyncOperation
Section titled “withAsyncOperation”withAsyncOperation: <
TArgs,TReturn>(operation,opts) => (…args) =>Promise<TReturn|undefined>
Type Parameters
Section titled “Type Parameters”TArgs extends unknown[]
TReturn
Section titled “TReturn”TReturn
Parameters
Section titled “Parameters”operation
Section titled “operation”(…args) => Promise<TReturn>
throwOnError?
Section titled “throwOnError?”boolean
Returns
Section titled “Returns”(…args) => Promise<TReturn | undefined>