better latest observation get data routine

This commit is contained in:
Matt Walsh
2022-12-22 14:46:58 -06:00
parent 25291efff5
commit 03dfbc462b
3 changed files with 43 additions and 21 deletions

View File

@@ -23,7 +23,9 @@ const getRegionalObservation = async (point, city) => {
const observation = await json(`${station}/observations/latest`);
// preload the image
if (!observation.properties.icon) return false;
preloadImg(getWeatherRegionalIconFromIconLink(observation.properties.icon, !observation.properties.daytime));
const icon = getWeatherRegionalIconFromIconLink(observation.properties.icon, !observation.properties.daytime);
if (!icon) return false;
preloadImg(icon);
// return the observation
return observation.properties;
} catch (e) {