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'){
|
} else if (response.data.status === 'REQUEST_DENIED'){
|
||||||
throw new Error(`API Request Denied: ${response.data.error_message}`);
|
throw new Error(`API Request Denied: ${response.data.error_message}`);
|
||||||
}
|
}
|
||||||
var lat = response.data.results[0].geometry.location.lat;
|
var loc = response.data.results[0].geometry.location;
|
||||||
var lng = response.data.results[0].geometry.location.lng;
|
|
||||||
console.log(response.data.results[0].formatted_address);
|
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);
|
return axios.get(weatherUrl);
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
var temperature = response.data.currently.temperature;
|
var temperature = response.data.currently.temperature;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user