|
|
@@ -30,7 +30,7 @@ export class WeatherCardComponent implements OnInit, OnChanges {
|
|
|
pipe = new DatePipe('es-ES')
|
|
|
newDate = Date.now();
|
|
|
currentDate = this.pipe.transform(this.newDate, 'fullDate')
|
|
|
-
|
|
|
+ errorWeather: boolean = false;
|
|
|
constructor(public weather: WeatherService, public router: Router) {
|
|
|
|
|
|
}
|
|
|
@@ -59,13 +59,18 @@ export class WeatherCardComponent implements OnInit, OnChanges {
|
|
|
this.weather.getWeather(city)
|
|
|
.pipe(first())
|
|
|
.subscribe((payload) => {
|
|
|
+ this.errorWeather = false;
|
|
|
this.cityName = payload.name
|
|
|
this.state = payload.weather[0].description;
|
|
|
this.temp = Math.ceil(payload.main.temp);
|
|
|
this.icon_exists = true;
|
|
|
this.icon = payload.weather[0].icon;
|
|
|
}, (err) => {
|
|
|
+ this.errorWeather = true;
|
|
|
this.errorMessage = err.error.message;
|
|
|
+ if (this.errorMessage == "city not found"){
|
|
|
+ this.errorMessage = "Datos del clima para el municipio de la planta no disponible.";
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
}
|