Passage du délai de mise à jour des données depuis le serveur à 15 secondes

This commit is contained in:
2024-12-17 01:12:54 +01:00
parent 0433e4695e
commit 409e13277e
3 changed files with 10 additions and 7 deletions

View File

@ -1,3 +1,4 @@
import { Constants } from '@/constants/Constants'
import { useAuth } from '@/hooks/useAuth'
import { useChallengeActions, useDownloadChallengeActions } from '@/hooks/useChallengeActions'
import { useDownloadChallenges } from '@/hooks/useChallenges'
@ -31,7 +32,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
headers: { "Authorization": `Bearer ${auth.token}` }}
).then(resp => resp.json()),
enabled: isAuthValid(auth),
refetchInterval: 5000,
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
})
useEffect(() => {
if (gameQuery.isSuccess && gameQuery.data)
@ -44,7 +45,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
headers: { "Authorization": `Bearer ${auth.token}` }}
).then(resp => resp.json()),
enabled: isAuthValid(auth) && !!game.playerId,
refetchInterval: 5000,
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
})
useEffect(() => {
if (playerQuery.isSuccess && playerQuery.data) {
@ -60,7 +61,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
).then(resp => resp.json()),
enabled: isAuthValid(auth) && !!game.playerId,
initialData: { data: [], meta: { currentPage: 0, lastPage: 0, nextPage: 0, prevPage: 0, total: 0, totalPerPage: 0 } },
refetchInterval: 5000,
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
})
useEffect(() => {
if (trainsQuery.isSuccess && trainsQuery.data)
@ -74,7 +75,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
).then(resp => resp.json()),
enabled: isAuthValid(auth),
initialData: { data: [], meta: { currentPage: 0, lastPage: 0, nextPage: 0, prevPage: 0, total: 0, totalPerPage: 0 } },
refetchInterval: 5000,
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
})
useEffect(() => {
if (challengesQuery.isSuccess && challengesQuery.data) {
@ -91,7 +92,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
headers: { "Authorization": `Bearer ${auth.token}` }}
).then(resp => resp.json()),
enabled: isAuthValid(auth) && !!game.playerId,
refetchInterval: 5000,
refetchInterval: Constants.QUERY_REFETCH_INTERVAL * 1000,
})
useEffect(() => {
if (moneyUpdatesQuery.isSuccess && moneyUpdatesQuery.data)