Skip to content

Instantly share code, notes, and snippets.

@nolimits4web
Last active October 4, 2019 13:17
Show Gist options
  • Save nolimits4web/476f4ff2579d4b546d06f1fce286d48c to your computer and use it in GitHub Desktop.
Save nolimits4web/476f4ff2579d4b546d06f1fce286d48c to your computer and use it in GitHub Desktop.
// 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