diff --git a/frontend/src/components/WeatherCard.tsx b/frontend/src/components/WeatherCard.tsx index cf682c1..e78bb01 100644 --- a/frontend/src/components/WeatherCard.tsx +++ b/frontend/src/components/WeatherCard.tsx @@ -5,7 +5,7 @@ import Cookies from "js-cookie"; const WeatherCard: React.FC = () => { const [city, setCity] = useState(""); - const apiKey = Cookies.get("apiKey") || ""; + const getAPIKey = () => Cookies.get("apiKey") || ""; const handleCityChange = (event: React.ChangeEvent) => { setCity(event.target.value); @@ -13,7 +13,7 @@ const WeatherCard: React.FC = () => { const handleSubmit = (event: React.FormEvent) => { event.preventDefault(); - fetchWeather(city, apiKey); + fetchWeather(city, getAPIKey()); }; return (