mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Adding second then on axios call (#1623)
Inspired by this issue : https://github.com/axios/axios/issues/792#issuecomment-289306590
This commit is contained in:
committed by
Justin Beckwith
parent
405fe690f9
commit
d74238e151
@@ -56,10 +56,15 @@ Performing a `GET` request
|
|||||||
// Make a request for a user with a given ID
|
// Make a request for a user with a given ID
|
||||||
axios.get('/user?ID=12345')
|
axios.get('/user?ID=12345')
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
|
// handle success
|
||||||
console.log(response);
|
console.log(response);
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
|
// handle error
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
})
|
||||||
|
.then(function () {
|
||||||
|
// always executed
|
||||||
});
|
});
|
||||||
|
|
||||||
// Optionally the request above could also be done as
|
// Optionally the request above could also be done as
|
||||||
@@ -73,7 +78,10 @@ axios.get('/user', {
|
|||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
});
|
})
|
||||||
|
.then(function () {
|
||||||
|
// always executed
|
||||||
|
});
|
||||||
|
|
||||||
// Want to use async/await? Add the `async` keyword to your outer function/method.
|
// Want to use async/await? Add the `async` keyword to your outer function/method.
|
||||||
async function getUser() {
|
async function getUser() {
|
||||||
|
|||||||
Reference in New Issue
Block a user