-
Hi, |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
Mar 17, 2021
Replies: 2 comments
-
a global error handler is available on the QueryCache, see the example here: https://react-query.tanstack.com/reference/QueryCache |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
stamahto
-
Thank you! Here is a full example with the Quasar Meta Framework based on Vue 3 import { boot } from 'quasar/wrappers'
import {
VueQueryPlugin,
QueryCache,
MutationCache,
} from '@tanstack/vue-query'
import { Notify } from 'quasar'
const notifyError = (message: string) => {
Notify.create({
color: `negative`,
message,
})
}
export default boot(({ app }) => {
app.use(VueQueryPlugin, {
queryClientConfig: {
queryCache: new QueryCache({
onError: (error, query) => {
notifyError(error.message)
},
}),
mutationCache: new MutationCache({
onError: (error, query) => {
console.error(query)
notifyError(error.message)
},
}),
},
})
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a global error handler is available on the QueryCache, see the example here: https://react-query.tanstack.com/reference/QueryCache