Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

main.ts

24 lines763 Bytes

1import 'vue-sonner/style.css'
2import { createApp } from 'vue'
3import { VueQueryPlugin } from '@tanstack/vue-query'
4import { persistQueryClient } from '@tanstack/query-persist-client-core'
5​
6import App from './App.vue'
7import { worker } from './mocks'
8import { persister, queryClient } from './queryClient'
9​
10worker.start().then(() => {
11 createApp(App)
12 .use(VueQueryPlugin, {
13 queryClient,
14 clientPersister: (client) =>
15 persistQueryClient({ queryClient: client, persister }),
16 clientPersisterOnSuccess: (client) => {
17 // resume mutations after initial restore from localStorage was successful
18 client.resumePausedMutations().then(() => {
19 client.invalidateQueries()
20 })
21 },
22 })
23 .mount('#app')
24})