Skip to content

Commit

Permalink
docs: Add missing keys to BaseQueryApi
Browse files Browse the repository at this point in the history
  • Loading branch information
petermekhaeil authored Feb 7, 2023
1 parent bdf8af3 commit d53eea2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/rtk-query/api/createApi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ export const { useGetPokemonByNameQuery } = pokemonApi
#### baseQuery function arguments

- `args` - The return value of the `query` function for a given endpoint
- `api` - The `BaseQueryApi` object, containing `signal`, `dispatch`, `getState` and `extra` properties
- `api` - The `BaseQueryApi` object contains:
- `signal` - An [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) object that may be used to abort DOM requests and/or read whether the request is aborted.
- `abort` - The [`abort()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort) method of the AbortController attached to `signal`.
- `dispatch` - The `store.dispatch` method for the corresponding Redux store
- `getState` - A function that may be called to access the current store state
- `extra` - Provided as thunk.extraArgument to the configureStore getDefaultMiddleware option.
- `endpoint` - The name of the endpoint.
- `type` - Type of request (`query` or `mutation`).
- `forced` - Indicates if a query has been forced.
- `extraOptions` - The value of the optional `extraOptions` property provided for a given endpoint

#### baseQuery function signature
Expand All @@ -106,8 +110,13 @@ export type BaseQueryFn<

export interface BaseQueryApi {
signal: AbortSignal
abort: (reason?: string) => void
dispatch: ThunkDispatch<any, any, any>
getState: () => unknown
extra: unknown
endpoint: string
type: 'query' | 'mutation'
forced?: boolean
}

export type QueryReturnValue<T = unknown, E = unknown, M = unknown> =
Expand Down

0 comments on commit d53eea2

Please sign in to comment.