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]) }, [stayType, stayValue, unregister, setValue])
useEffect(() => { useEffect(() => {
if (locationString) { if (location) {
sessionStorage.setItem(sessionStorageKey, locationString) sessionStorage.setItem(sessionStorageKey, JSON.stringify(location))
} }
}, [locationString]) }, [location])
function getLocationLabel(): string { function getLocationLabel(): string {
if (location?.type === "hotels") { if (location?.type === "hotels") {