Stabilité téléchargement des données
This commit is contained in:
parent
3d50cee9a9
commit
57676abb02
@ -57,6 +57,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
|
||||
headers: { "Authorization": `Bearer ${auth.token}` }}
|
||||
).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,
|
||||
})
|
||||
useEffect(() => {
|
||||
@ -70,6 +71,7 @@ export default function GameProvider({ children }: { children: ReactNode }) {
|
||||
headers: { "Authorization": `Bearer ${auth.token}` }}
|
||||
).then(resp => resp.json()),
|
||||
enabled: isAuthValid(auth),
|
||||
initialData: { data: [], meta: { currentPage: 0, lastPage: 0, nextPage: 0, prevPage: 0, total: 0, totalPerPage: 0 } },
|
||||
refetchInterval: 5000,
|
||||
})
|
||||
useEffect(() => {
|
||||
|
@ -39,13 +39,14 @@ export default function GeolocationProvider({ children }: { children: ReactNode
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}).then(resp => resp.json()),
|
||||
initialData: [],
|
||||
enabled: isAuthValid(auth),
|
||||
refetchInterval: 5000,
|
||||
})
|
||||
useEffect(() => {
|
||||
if (lastLocationsQuery.isSuccess && lastLocationsQuery.data)
|
||||
setLastPlayerLocations(lastLocationsQuery.data)
|
||||
}, [lastLocationsQuery.status, lastLocationsQuery.dataUpdatedAt, auth])
|
||||
}, [lastLocationsQuery.status, lastLocationsQuery.dataUpdatedAt])
|
||||
|
||||
return <>
|
||||
{children}
|
||||
|
Loading…
Reference in New Issue
Block a user