UNPKG

ngrx-rtk-query

Version:
23 lines (22 loc) 1.51 kB
import { type Api, type ApiContext, type CoreModule, type EndpointDefinitions, type PrefetchOptions, type QueryKeys, type SerializeQueryArgs } from '@reduxjs/toolkit/query'; import { type AngularHooksModuleOptions } from './module'; import { type InfiniteQueryHooks, type MutationHooks, type QueryHooks } from './types'; /** * * @param opts.api - An API with defined endpoints to create hooks for * @param opts.moduleOptions.dispatch - The version of the `dispatch` to be used * @param opts.moduleOptions.useSelector - The version of the `useSelector` hook to be used * @param opts.moduleOptions.getState - The version of the `getState` to be used * @returns An object containing functions to generate hooks based on an endpoint */ export declare function buildHooks<Definitions extends EndpointDefinitions>({ api, moduleOptions: { hooks: { dispatch, useSelector, getState }, createSelector, }, serializeQueryArgs, context, }: { api: Api<any, Definitions, any, any, CoreModule>; moduleOptions: AngularHooksModuleOptions; serializeQueryArgs: SerializeQueryArgs<any>; context: ApiContext<Definitions>; }): { buildQueryHooks: (endpointName: string) => QueryHooks<any>; buildInfiniteQueryHooks: (endpointName: string) => InfiniteQueryHooks<any>; buildMutationHook: (name: string) => MutationHooks<any>; usePrefetch: <EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, defaultOptions?: PrefetchOptions) => (arg: any, options?: PrefetchOptions) => void; };