tooot/src/utils/queryHooks/index.ts

27 lines
538 B
TypeScript
Raw Normal View History

import { QueryClient } from '@tanstack/react-query'
2021-05-12 15:40:55 +02:00
2022-12-20 00:45:53 +01:00
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 60 * 5,
retry: (failureCount, error: any) => {
if (error?.status === 404) {
return false
}
if (failureCount <= 3) {
return true
} else {
return false
}
}
}
}
})
2021-05-12 15:40:55 +02:00
2023-01-02 23:18:22 +01:00
// @ts-ignore
import('react-query-native-devtools').then(({ addPlugin }) => {
addPlugin({ queryClient })
})
2021-05-12 15:40:55 +02:00
export default queryClient