From 72394d54a23927a6455e1b236c55a390a6c2d39a Mon Sep 17 00:00:00 2001 From: shivani11jadhav Date: Mon, 11 May 2026 20:57:57 +0530 Subject: [PATCH] feat: persist last searched city and implement dark mode toggle --- public/script.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/script.js b/public/script.js index 2661353..dd71919 100644 --- a/public/script.js +++ b/public/script.js @@ -208,7 +208,13 @@ window.addEventListener('DOMContentLoaded', () => { console.error('Service Worker registration failed:', err); }); } + const lastCity = localStorage.getItem('lastCity'); + +if (lastCity) { + fetchWeatherData(lastCity); +} else { fetchWeatherData(DEFAULT_CITY); +} }); function handleSearch() {