January 2018
Beginner
658 pages
13h 10m
English
To get started, we'll return a call to axios.get, passing in the URL. We just defined that, it is weatherUrl:
var lat = response.data.results[0].geometry.location.lat; var lng = response.data.results[0].geometry.location.lng; var weatherUrl = `https://api.forecast.io/forecast/4a04d1c42fd9d32c97a2c291a32d5e2d/${lat},${lng}`; console.log(response.data.results[0].formatted_address); return axios.get(weatherUrl);
Now that we have this call returning, we can attach another then call right between our previous then call and catch call, by calling then, passing in one function, just like this:
return axios.get(weatherUrl);}).then(() => { }).catch((e) => { if (e.code === 'ENOTFOUND') {
This function will get called when ...