Update src/components/services/OpenWeather.vue

Co-authored-by: Bastien Wirtz <bastien.wirtz@gmail.com>
This commit is contained in:
Robin Schneider 2021-10-25 14:08:31 +02:00 committed by GitHub
parent f2c901a1ec
commit 9fce0ce5a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,8 @@ export default {
locationQuery = `q=${this.item.location}`; locationQuery = `q=${this.item.location}`;
} }
const url = `https://api.openweathermap.org/data/2.5/weather?${locationQuery}&appid=${this.item.apikey}&units=${this.item.units}`; const apiKey = this.item.apikey || this.item.apiKey;
const url = `https://api.openweathermap.org/data/2.5/weather?${locationQuery}&appid=${apiKey}&units=${this.item.units}`;
fetch(url) fetch(url)
.then((response) => { .then((response) => {
if (!response.ok) { if (!response.ok) {