Stockage de la géolocalisation en arrière-plan et utilisation sur la carte
This commit is contained in:
9
client/hooks/useLocation.ts
Normal file
9
client/hooks/useLocation.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { LocationObject } from "expo-location"
|
||||
import { useAppDispatch, useAppSelector } from "./useStore"
|
||||
import { setLocation } from "@/utils/features/location/locationSlice"
|
||||
|
||||
export const useLocation = () => useAppSelector((state) => state.location.location)
|
||||
export const useSetLocation = () => (location: LocationObject) => {
|
||||
const dispatch = useAppDispatch()
|
||||
dispatch(setLocation(location))
|
||||
}
|
Reference in New Issue
Block a user