import { create } from 'zustand'; import { locations as initialLocations } from '@/data/locations'; console.log('Initial locations:', initialLocations); const useLocationStore = create((set) => ({ locations: initialLocations, addLocation: (newLocation) => set((state) => ({ locations: [newLocation, ...state.locations], })), updateLocation: (id, updatedData) => set((state) => ({ locations: state.locations.map((loc) => loc.id == id ? { ...loc, ...updatedData } : loc ), })), deleteLocation: (id) => set((state) => ({ locations: state.locations.filter((loc) => loc.id != id), })), })); export default useLocationStore;