From 5de82e2431a15a8cdb395cf512759ccb504ded2c Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Fri, 1 Dec 2017 00:33:19 -0500 Subject: [PATCH] promise --- app-promise.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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;