fix: pass correct location data to session storage

This commit is contained in:
Arvid Norlin
2024-12-20 10:15:01 +01:00
parent f7e396ff50
commit f7ec34d86f

View File

@@ -162,10 +162,10 @@ export default function Search({ locations, handlePressEnter }: SearchProps) {
}, [stayType, stayValue, unregister, setValue])
useEffect(() => {
if (locationString) {
sessionStorage.setItem(sessionStorageKey, locationString)
if (location) {
sessionStorage.setItem(sessionStorageKey, JSON.stringify(location))
}
}, [locationString])
}, [location])
function getLocationLabel(): string {
if (location?.type === "hotels") {