From 25ca687448162787dff77180cbfe57ec133e1223 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sat, 14 Dec 2024 17:21:55 +0100 Subject: [PATCH] =?UTF-8?q?Transmission=20des=20positions=20seulement=20ap?= =?UTF-8?q?r=C3=A8s=20connexion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/GeolocationProvider.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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],