switched weather info for aachen with cologne
This commit is contained in:
parent
51b57d570f
commit
e59ab7ae6b
@ -4,6 +4,7 @@ const log = require('loglevel');
|
|||||||
|
|
||||||
const AACHEN = 3247449;
|
const AACHEN = 3247449;
|
||||||
const STEINFURT = 2828105;
|
const STEINFURT = 2828105;
|
||||||
|
const COLOGNE_DEUTZ = 2937790;
|
||||||
|
|
||||||
class WeatherData extends EventEmitter {
|
class WeatherData extends EventEmitter {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -11,7 +12,7 @@ class WeatherData extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get initial() {
|
get initial() {
|
||||||
return { aachen: null };
|
return { deutz: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
@ -24,15 +25,15 @@ class WeatherData extends EventEmitter {
|
|||||||
|
|
||||||
fetch() {
|
fetch() {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
axios.get(`https://api.openweathermap.org/data/2.5/weather?id=${AACHEN}&units=metric&appid=f16fb438a43a12fb3347ca17937649be`).catch(err => log.error(err.config.url, err.message)),
|
axios.get(`https://api.openweathermap.org/data/2.5/weather?id=${COLOGNE_DEUTZ}&units=metric&appid=f16fb438a43a12fb3347ca17937649be`).catch(err => log.error(err.config.url, err.message)),
|
||||||
]).then(resp => {
|
]).then(resp => {
|
||||||
let aachen = null;
|
let deutz = null;
|
||||||
|
|
||||||
if (resp[0] != undefined) {
|
if (resp[0] != undefined) {
|
||||||
aachen = resp[0].data.main.temp + "°C";
|
deutz = resp[0].data.main.temp + "°C";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emit("data", { aachen });
|
this.emit("data", { deutz });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,7 +115,7 @@
|
|||||||
<div class="title">Weather</div>
|
<div class="title">Weather</div>
|
||||||
|
|
||||||
<div class="databox">
|
<div class="databox">
|
||||||
<img class="icon" src="img/weather.png"><div class="data">Aachen:</div> <div class="data d-weather-aachen">---</div>
|
<img class="icon" src="img/weather.png"><div class="data">Köln-Deutz:</div> <div class="data d-weather-deutz">---</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user