Skip to content

Commit

Permalink
destination , user location
Browse files Browse the repository at this point in the history
  • Loading branch information
Satora1 committed Oct 11, 2024
1 parent 2266cf8 commit 506226b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions store/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { LocationStore } from "@/types/type"
import { create } from "zustand"

export const useLocationStore = create<LocationStore>((set) => ({
userAddress: null,
userLatitude: null,
userLongitude: null,
destinationAddress: null,
destinationLatitude: null,
destinationLongitude: null,
setUserLocation: ({ latitude, longitude, address }: { latitude: number, longitude: number, address: string }) => {
set(() => ({
userLatitude: latitude,
userLongitude: longitude,
userAddress: address,
}))
},
setDestinationLocation: ({ latitude, longitude, address }: { latitude: number, longitude: number, address: string }) => {
set(() => ({
destinationLatitude: latitude,
destinationLongitude: longitude,
destinationAddress: address,
}))
},
}))

0 comments on commit 506226b

Please sign in to comment.