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

main.ts

26 lines814 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'
9import { router } from './router'
10​
11worker.start().then(() => {
12 createApp(App)
13 .use(VueQueryPlugin, {
14 queryClient,
15 clientPersister: (client) =>
16 persistQueryClient({ queryClient: client, persister }),
17 clientPersisterOnSuccess: (client) => {
18 // resume mutations after initial restore from localStorage was successful
19 client.resumePausedMutations().then(() => {
20 client.invalidateQueries()
21 })
22 },
23 })
24 .use(router)
25 .mount('#app')
26})