Last active
October 4, 2019 13:17
-
-
Save nolimits4web/476f4ff2579d4b546d06f1fce286d48c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In v4 we had | |
app.request.promise(...) | |
.then((data) => { | |
console.log(`Response data is: ${data}`) | |
}) | |
.catch((status) => { | |
console.log(status); | |
}) | |
// In v5 it is | |
app.request.promise(...) | |
.then((res) => { | |
console.log(`Response data is: ${res.data}`) | |
console.log(`Response status is: ${res.status}`) | |
}) | |
.catch((err) => { | |
console.log(err.status); | |
console.log(err.message); | |
}) | |
// or | |
app.request.promise(...) | |
.then(({ data, xhr, status }) => { | |
console.log(`Response data is: ${data}`) | |
console.log(`Response status is: ${status}`) | |
}) | |
.catch(({ xhr, status, message }) => { | |
console.log(status); | |
console.log(message); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment