Open History to see the last commit
1import { provideHttpClient, withFetch } from '@angular/common/http'
2import {
3 QueryClient,
4 provideTanStackQuery,
5} from '@tanstack/angular-query-experimental'
6import { withPersistQueryClient } from '@tanstack/angular-query-persist-client'
7import { withDevtools } from '@tanstack/angular-query-experimental/devtools'
8import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister'
9import type { ApplicationConfig } from '@angular/core'
10β
11const localStoragePersister = createAsyncStoragePersister({
12 storage: window.localStorage,
13})
14β
15export const appConfig: ApplicationConfig = {
16 providers: [
17 provideHttpClient(withFetch()),
18 provideTanStackQuery(
19 new QueryClient({
20 defaultOptions: {
21 queries: {
22 staleTime: 60 * 1000, // 1 minute
23 gcTime: 24 * 60 * 60 * 1000, // 24 hours
24 },
25 },
26 }),
27 withDevtools(),
28 withPersistQueryClient({
29 persistOptions: {
30 persister: localStoragePersister,
31 },
32 }),
33 ),
34 ],
35}