export function updateWeather() { const city = document.getElementById("city").value; fetch(`/weather?city=${encodeURIComponent(city)}`) .then(res => res.json()) .then(data => { if (!data) { document.getElementById("weather-summary").innerText = `Error, "${city}" city not found`; return } document.getElementById("weather-summary").innerText = data.summary; document.getElementById("weather-icon").src = data.icon_url; }); }