Moving openweathermap specific check for hourly into its provider and make invalid types fail nicer

This commit is contained in:
buxxi
2021-01-23 10:13:41 +01:00
parent a3cb0b7b96
commit d48113f2d9
2 changed files with 27 additions and 8 deletions

View File

@@ -77,6 +77,18 @@ WeatherProvider.register("openweathermap", {
.finally(() => this.updateAvailable());
},
/**
* Overrides method for setting config to check if endpoint is correct for hourly
*
* @param config
*/
setConfig(config) {
this.config = config;
if (this.config.type === "hourly") {
this.config.weatherEndpoint = "/onecall";
}
},
/** OpenWeatherMap Specific Methods - These are not part of the default provider methods */
/*
* Gets the complete url for the request