Open History to see the last commit
1import { createNoopInjectionToken } from './util/create-injection-token/create-injection-token'
2import type { QueryClient } from '@tanstack/query-core'
3β
4const tokens = createNoopInjectionToken<QueryClient>('QueryClientToken')
5β
6/**
7 * Injects the `QueryClient` instance into the component or service.
8 *
9 * **Example**
10 * ```ts
11 * const queryClient = injectQueryClient();
12 * ```
13 * @returns The `QueryClient` instance.
14 * @public
15 */
16export const injectQueryClient = tokens[0]
17β
18/**
19 * Usually {@link provideAngularQuery} is used once to set up TanStack Query and the
20 * {@link https://tanstack.com/query/latest/docs/reference/QueryClient|QueryClient}
21 * for the entire application. You can use `provideQueryClient` to provide a
22 * different `QueryClient` instance for a part of the application.
23 * @public
24 */
25export const provideQueryClient = tokens[1]