diff --git a/1114/app/components/weather/WeatherCard.tsx b/1114/app/components/weather/WeatherCard.tsx index 1d594f7..51f8436 100644 --- a/1114/app/components/weather/WeatherCard.tsx +++ b/1114/app/components/weather/WeatherCard.tsx @@ -9,6 +9,7 @@ export function WeatherCard() { return (
+ {currentWeather ? (
diff --git a/1114/app/components/weather/WeatherDetailsCrid.tsx b/1114/app/components/weather/WeatherDetailsGrid.tsx similarity index 94% rename from 1114/app/components/weather/WeatherDetailsCrid.tsx rename to 1114/app/components/weather/WeatherDetailsGrid.tsx index 837db65..d3cbb85 100644 --- a/1114/app/components/weather/WeatherDetailsCrid.tsx +++ b/1114/app/components/weather/WeatherDetailsGrid.tsx @@ -10,7 +10,8 @@ interface WeatherInfoItemProps { subtitle?: string; } -function WeatherInfoItem({ icon, label, value, subtitle }: WeatherInfoItemProps) { +export function WeatherInfoItem({ icon, label, value, subtitle }: WeatherInfoItemProps) { + return (
@@ -28,6 +29,8 @@ function WeatherInfoItem({ icon, label, value, subtitle }: WeatherInfoItemProps) export function WeatherDetailsGrid() { + const {currentWeather} = useWeatherStore(); + if (!currentWeather) return null; <>
{ if (error) { toast.error(error) setError("") + setError("") } }, [error, setError]) + }, [error, setError]) return (
diff --git a/1114/app/services/weatherApi.ts b/1114/app/services/weatherApi.ts index e40a53a..0f2a275 100644 --- a/1114/app/services/weatherApi.ts +++ b/1114/app/services/weatherApi.ts @@ -1,5 +1,5 @@ import axios, {type AxiosInstance,AxiosError} from 'axios'; -import {WeatherData} from "@/store/weatherStore"; +import {type WeatherData} from "@/store/weatherStore"; //配置常量 const API_KEY = '5097cc3212ea9c460b01e2be936c94d5';