diff --git a/app-promise.js b/app-promise.js index 10eef26..77dee57 100644 --- a/app-promise.js +++ b/app-promise.js @@ -25,10 +25,9 @@ axios.get(geocodeUrl).then((response) => { } else if (response.data.status === 'REQUEST_DENIED'){ throw new Error(`API Request Denied: ${response.data.error_message}`); } - var lat = response.data.results[0].geometry.location.lat; - var lng = response.data.results[0].geometry.location.lng; + var loc = response.data.results[0].geometry.location; console.log(response.data.results[0].formatted_address); - var weatherUrl = `https://api.darksky.net/forecast/${API_KEY}/${lat},${lng}`; + var weatherUrl = `https://api.darksky.net/forecast/${API_KEY}/${loc.lat},${loc.lng}`; return axios.get(weatherUrl); }).then((response) => { var temperature = response.data.currently.temperature;