Files
points-of-interest/client/src/store/useAppStore.ts
T
2025-10-10 15:29:39 +02:00

24 lines
738 B
TypeScript

import { create } from 'zustand'
import type { Point } from '@/types/api'
type Nullable<T> = T | null
interface AppState {
userLocation: Nullable<Point>
locationError: Nullable<string>
isRequestingLocation: boolean
setUserLocation: (location: Nullable<Point>) => void
setLocationError: (error: Nullable<string>) => void
setIsRequestingLocation: (isRequesting: boolean) => void
}
export const useAppStore = create<AppState>((set) => ({
userLocation: null,
locationError: null,
isRequestingLocation: false,
setUserLocation: (userLocation) => set({ userLocation }),
setLocationError: (locationError) => set({ locationError }),
setIsRequestingLocation: (isRequestingLocation) => set({ isRequestingLocation }),
}))