Address updates
This commit is contained in:
@@ -31,11 +31,11 @@ function Header({
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (weather && basicWeather) {
|
||||
if (weather !== undefined && basicWeather !== undefined) {
|
||||
setCurrent({
|
||||
icon: weather.features[0].properties.icon?.replace('medium', 'large') || '',
|
||||
icon: weather.features[0]?.properties.icon?.replace('medium', 'large') || '',
|
||||
temperature: Math.round(
|
||||
(weather.features[0].properties.temperature.value * 9) / 5 + 32,
|
||||
(weather.features[0]?.properties.temperature.value * 9) / 5 + 32,
|
||||
),
|
||||
highTemp: Math.round(
|
||||
(basicWeather.properties.maxTemperature.values[0].value * 9) / 5 + 32,
|
||||
@@ -44,13 +44,13 @@ function Header({
|
||||
(basicWeather.properties.minTemperature.values[0].value * 9) / 5 + 32,
|
||||
),
|
||||
precipitation:
|
||||
weather.features[0].properties.precipitationLastHour.value || 'N/A',
|
||||
humidity: Math.round(weather.features[0].properties.relativeHumidity.value),
|
||||
weather.features[0]?.properties.precipitationLastHour.value || 'N/A',
|
||||
humidity: Math.round(weather.features[0]?.properties.relativeHumidity.value),
|
||||
heatIndex: Math.round(
|
||||
(weather.features[0].properties.heatIndex.value * 9) / 5 + 32,
|
||||
(weather.features[0]?.properties.heatIndex.value * 9) / 5 + 32,
|
||||
),
|
||||
windSpeed: Math.round(weather.features[0].properties.windSpeed.value / 1.60934),
|
||||
windDirection: weather.features[0].properties.windDirection.value,
|
||||
windSpeed: Math.round(weather.features[0]?.properties.windSpeed.value / 1.60934),
|
||||
windDirection: weather.features[0]?.properties.windDirection.value,
|
||||
});
|
||||
}
|
||||
}, [weather, basicWeather]);
|
||||
|
||||
Reference in New Issue
Block a user