16 lines
714 B
TypeScript
16 lines
714 B
TypeScript
import { LocationObject } from "expo-location"
|
|
import { useAppDispatch, useAppSelector } from "./useStore"
|
|
import { setLastLocation, unqueueLocation } from "@/utils/features/location/locationSlice"
|
|
|
|
export const useLastOwnLocation = () => useAppSelector((state) => state.location.lastOwnLocation)
|
|
export const useQueuedLocations = () => useAppSelector((state) => state.location.queuedLocations)
|
|
|
|
export const useSetLastLocation = () => {
|
|
const dispatch = useAppDispatch()
|
|
return (location: LocationObject) => dispatch(setLastLocation(location))
|
|
}
|
|
export const useUnqueueLocation = () => {
|
|
const dispatch = useAppDispatch()
|
|
return (location: LocationObject) => dispatch(unqueueLocation(location))
|
|
}
|