promise
This commit is contained in:
parent
079d0e738e
commit
5de82e2431
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user