diff --git a/src/components/widgets/weather/icon.jsx b/src/components/widgets/weather/icon.jsx index 1a250fbe3..b61052540 100644 --- a/src/components/widgets/weather/icon.jsx +++ b/src/components/widgets/weather/icon.jsx @@ -3,7 +3,5 @@ import mapIcon from "utils/condition-map"; export default function Icon({ condition, timeOfDay }) { const Icon = mapIcon(condition, timeOfDay); - return ( - - ); + return ; } diff --git a/src/components/widgets/weather/weather.jsx b/src/components/widgets/weather/weather.jsx index 7e42c17d7..0308932dd 100644 --- a/src/components/widgets/weather/weather.jsx +++ b/src/components/widgets/weather/weather.jsx @@ -1,40 +1,41 @@ import useSWR from "swr"; +import { BiError } from "react-icons/bi"; + import Icon from "./icon"; export default function Weather({ options }) { const { data, error } = useSWR( - `/api/widgets/weather?lat=${options.latitude}&lon=${options.longitude}&apiKey=${options.apiKey}&duration=${options.cache}`, - { - revalidateOnFocus: false, - revalidateOnReconnect: false, - } + `/api/widgets/weather?lat=${options.latitude}&lon=${options.longitude}&apiKey=${options.apiKey}&duration=${options.cache}` ); if (error) { - return
failed to load
; + return ( +
+ +
+ API + Error +
+
+ ); } if (!data) { - return
; + return
; } if (data.error) { - return
; + return
; } return (
- +
- {Math.round(data.current.temp_f)}° - - - {data.current.condition.text} + {options.units === "metric" ? data.current.temp_c : data.current.temp_f}° + {data.current.condition.text}
);