Removed log

This commit is contained in:
Zakary Timson 2018-11-14 13:49:57 -05:00
parent 86ffa2efe3
commit d69949538c

View File

@ -28,6 +28,7 @@ export class WeatherService {
constructor(httpClient: HttpClient) { constructor(httpClient: HttpClient) {
timer(0, 5 * 60000).subscribe(async () => { timer(0, 5 * 60000).subscribe(async () => {
// Current weather information
httpClient.get(`https://api.openweathermap.org/data/2.5/weather?q=${this.city},${this.countryCode}&APPID=${this.apiKey}&units=metric`).toPromise().then((weather: any) => { httpClient.get(`https://api.openweathermap.org/data/2.5/weather?q=${this.city},${this.countryCode}&APPID=${this.apiKey}&units=metric`).toPromise().then((weather: any) => {
this.cloudCover = weather.clouds.all; this.cloudCover = weather.clouds.all;
this.humidity = weather.main.humidity; this.humidity = weather.main.humidity;
@ -41,6 +42,8 @@ export class WeatherService {
this.weather = weather.weather[0].description; this.weather = weather.weather[0].description;
this.wind = [weather.wind.deg, Math.round(weather.wind.speed)]; this.wind = [weather.wind.deg, Math.round(weather.wind.speed)];
}); });
// 5 day forecast
httpClient.get(`https://api.openweathermap.org/data/2.5/forecast?q=${this.city},${this.countryCode}&APPID=${this.apiKey}&units=metric`).toPromise().then((weather: any) => { httpClient.get(`https://api.openweathermap.org/data/2.5/forecast?q=${this.city},${this.countryCode}&APPID=${this.apiKey}&units=metric`).toPromise().then((weather: any) => {
let temp = weather.list.filter(weather => weather.dt_txt.indexOf('12:00:00') != -1); let temp = weather.list.filter(weather => weather.dt_txt.indexOf('12:00:00') != -1);
temp.splice(0, temp.length - 5); temp.splice(0, temp.length - 5);
@ -49,7 +52,6 @@ export class WeatherService {
icon: this.weatherCodes[weather.weather[0].id].icon, icon: this.weatherCodes[weather.weather[0].id].icon,
temp: Math.round(weather.main.temp) temp: Math.round(weather.main.temp)
})); }));
console.log(this.forecast[3])
}); });
}); });
} }