Files
points-of-interest/client/src/store/use-app-store.ts
T
2025-10-12 03:29:23 +02:00

24 lines
740 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 }),
}));