I\'m trying to making a weather app that displays the weather and the temperature of many days of the week. I\'m currently using openweathermap api for such task, the thing
Using native DOMParser getCurrentCity(location) can be written:
function getCurrentCity(location) {
const lat = location.coords.latitude;
const lon = location.coords.longitude;
return fetch(apis.currentWeather.url(lat, lon))
.then(response => response.text())
.then(str => (new window.DOMParser()).parseFromString(str, "text/xml"))
.then(data => console.log(data))
}