diff --git a/client/components/GeolocationProvider.tsx b/client/components/GeolocationProvider.tsx index f855beb..627dc75 100644 --- a/client/components/GeolocationProvider.tsx +++ b/client/components/GeolocationProvider.tsx @@ -23,12 +23,14 @@ export default function GeolocationProvider({ children }: { children: ReactNode onError: ({ response, error }) => { console.error(response, error) } }) + if (Platform.OS !== "web") { useEffect(() => { - if (geolocationsQueue.length === 0 || geolocationMutation.isPending || Platform.OS === "web") - return - const locToSend = geolocationsQueue[0] - geolocationMutation.mutate(locToSend) - }, [auth, geolocationsQueue]) + if (geolocationsQueue.length === 0 || geolocationMutation.isPending || isAuthValid(auth)) + return + const locToSend = geolocationsQueue[0] + geolocationMutation.mutate(locToSend) + }, [auth, geolocationMutation.status, geolocationsQueue]) + } const lastLocationsQuery = useQuery({ queryKey: ['get-last-locations', auth.token],