Skip to content

Commit 610228a

Browse files
committed
fix(weather): update options-modal component to use correct storage format and remove console log from home page
1 parent 019b18b commit 610228a

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/layouts/weather/components/options-modal.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ interface WeatherOptionsModalProps {
1212

1313
export function WeatherOptionsModal({ onClose, show }: WeatherOptionsModalProps) {
1414
const { setSelectedCity, selectedCity } = useContext(storeContext)
15+
1516
const [inputValue, setInputValue] = useState<string | null>('')
17+
1618
const { data: relatedCities, isSuccess } = useGetRelatedCities(inputValue || '')
1719

1820
const handleInputChange = (value: string) => {
@@ -42,7 +44,7 @@ export function WeatherOptionsModal({ onClose, show }: WeatherOptionsModalProps)
4244
if (!city.lat || !city.lon) return
4345

4446
setSelectedCity(city)
45-
setToStorage(StoreKey.SELECTED_CITY, JSON.stringify(city))
47+
setToStorage(StoreKey.SELECTED_CITY, city)
4648

4749
setInputValue(null)
4850
onClose()

src/pages/home.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export function HomePage() {
1717
)
1818

1919
const city = getFromStorage<SelectedCity>(StoreKey.SELECTED_CITY)
20-
console.log('city: ', city, typeof city)
2120
const [selectedCity, setSelectedCity] = useState<SelectedCity>(
2221
city || {
2322
city: 'Tehran',

0 commit comments

Comments
 (0)