1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Tune queries

This commit is contained in:
xmflsct
2023-01-09 19:18:48 +01:00
parent be772f905d
commit b9c4b139f5
2 changed files with 6 additions and 12 deletions

View File

@ -1,5 +1,7 @@
import { QueryClient } from '@tanstack/react-query'
export const globalRetry = (failureCount: number) => failureCount <= 2
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
@ -8,17 +10,9 @@ export const queryClient = new QueryClient({
if ([401, 404].includes(error?.status)) {
return false
}
if (failureCount <= 2) {
return true
} else {
return false
}
return globalRetry(failureCount)
}
}
},
logger: {
log: log => console.log(log),
warn: () => {},
error: () => {}
}
})