fix: update error response status and improve success message handling in weather fetching

This commit is contained in:
2025-08-03 23:52:23 +02:00
parent 0361a743ef
commit 9b0f7daa2c
3 changed files with 2 additions and 4 deletions

View File

@@ -21,9 +21,6 @@ const WeatherCard: React.FC = () => {
toast
.promise(fetchWeather(city, getUnit()), {
pending: "Fetching weather data...",
success: "Weather data loaded successfully!",
error:
"Failed to load weather data. Please check your entered city name. (Error: x4040)",
})
.then(() => {
if (localStorage.getItem("weather")) {

View File

@@ -21,6 +21,7 @@ export const fetchWeather = async (city: string, units: string) => {
return;
}
localStorage.setItem("weather", JSON.stringify(responseData.data));
myToast(responseData.success, "success");
return;
} catch (error) {
const errorMsg = JSON.stringify(error);