Transmission des positions seulement après connexion

This commit is contained in:
Emmy D'Anello 2024-12-14 17:21:55 +01:00
parent 0f16edd8cc
commit 25ca687448
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -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],