fix: increase autoClose duration for Toast notifications to improve user experience

refactor: enhance error handling in fetchWeather function with detailed console messages
This commit is contained in:
2025-07-30 11:23:42 +02:00
parent 6a7a66420a
commit e505d9b0e8
4 changed files with 6 additions and 6 deletions
+1 -3
View File
@@ -2,7 +2,6 @@ import React from "react";
import { useState } from "react";
import { fetchWeather } from "../utils/apiFunc";
import Cookies from "js-cookie";
import IsLoading from "./IsLoading"; // FIX ERRROR
import { toast } from "react-toastify";
const WeatherCard: React.FC = () => {
@@ -20,7 +19,7 @@ const WeatherCard: React.FC = () => {
toast.promise(fetchWeather(city, getAPIKey()), {
pending: "Fetching weather data...",
success: "Weather data loaded successfully!",
error: "Error loading weather data!",
error: "Error loading weather data! (Check console for details)",
});
setLoading(false);
};
@@ -42,7 +41,6 @@ const WeatherCard: React.FC = () => {
/>
<button type="submit">Get Weather</button>
</form>
{loading && <IsLoading message="Loading weather data..." />}
</div>
);
};