remove blank travel forecast lines when there's a fetch error
This commit is contained in:
parent
7755090d32
commit
e67774aa23
909
package-lock.json
generated
909
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -44,7 +44,7 @@ class TravelForecast extends WeatherDisplay {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`GetTravelWeather for ${city.Name} failed`);
|
console.error(`GetTravelWeather for ${city.Name} failed`);
|
||||||
console.error(e.status, e.responseJSON);
|
console.error(e.status, e.responseJSON);
|
||||||
return { name: city.Name };
|
return { name: city.Name, error: true };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ class TravelForecast extends WeatherDisplay {
|
||||||
const cities = this.data;
|
const cities = this.data;
|
||||||
|
|
||||||
const lines = cities.map((city) => {
|
const lines = cities.map((city) => {
|
||||||
|
if (city.error) return false;
|
||||||
const fillValues = {};
|
const fillValues = {};
|
||||||
|
|
||||||
// city name
|
// city name
|
||||||
|
@ -100,7 +101,7 @@ class TravelForecast extends WeatherDisplay {
|
||||||
fillValues.error = 'NO TRAVEL DATA AVAILABLE';
|
fillValues.error = 'NO TRAVEL DATA AVAILABLE';
|
||||||
}
|
}
|
||||||
return this.fillTemplate('travel-row', fillValues);
|
return this.fillTemplate('travel-row', fillValues);
|
||||||
});
|
}).filter((d) => d);
|
||||||
list.append(...lines);
|
list.append(...lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue