diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2025-06-16 02:05:40 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2025-06-16 02:05:40 +0000 |
| commit | 755163a9f803e6959afb4568baa55538b9628cab (patch) | |
| tree | 4469b0d7c6e8b2a7185b271d9589e8de4724d4f2 /src/lib/maps/stores/useMaps.js | |
| parent | 5669295b8cff1a9c9e559dd263599123a2ad6e92 (diff) | |
| parent | 8ca6c0aa1b2a578332ff1c3706f58530f549352e (diff) | |
Merged in biteship-merge (pull request #420)
Biteship merge
Diffstat (limited to 'src/lib/maps/stores/useMaps.js')
| -rw-r--r-- | src/lib/maps/stores/useMaps.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lib/maps/stores/useMaps.js b/src/lib/maps/stores/useMaps.js new file mode 100644 index 00000000..c57a05ad --- /dev/null +++ b/src/lib/maps/stores/useMaps.js @@ -0,0 +1,32 @@ +import { create } from "zustand"; + +const center = { + lat: -6.200000, // Default latitude (Jakarta) + lng: 106.816666, // Default longitude (Jakarta) +}; + +export const useMaps = create((set) => ({ + // State existing + selectedPosition: center, + addressMaps: '', + detailAddress: {}, + pinedMaps: false, + + // State tambahan untuk penyimpanan posisi sementara + tempPositionCreate: null, + tempPositionEdit: null, + + // Setter existing + setSelectedPosition: (position) => set({ selectedPosition: position }), + setAddressMaps: (addressMaps) => set({ addressMaps }), + setDetailAddress: (detailAddress) => set({ detailAddress }), + setPinedMaps: (pinedMaps) => set({ pinedMaps }), + + // Setter tambahan untuk posisi sementara + setTempPositionCreate: (position) => set({ tempPositionCreate: position }), + setTempPositionEdit: (position) => set({ tempPositionEdit: position }), + + // Opsional: Reset jika ingin clear saat keluar halaman + resetTempPositionCreate: () => set({ tempPositionCreate: null }), + resetTempPositionEdit: () => set({ tempPositionEdit: null }), +})); |
