Skip to content

Instantly share code, notes, and snippets.

View diegolaciar's full-sized avatar

Diego diegolaciar

View GitHub Profile
@diegolaciar
diegolaciar / axios-catch-error.js
Created January 22, 2019 19:28 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
axios.put(this.apiBaseEndpoint + '/' + id, input)
.then((response) => {
// Success
})
.catch((error) => {
// Error
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
// console.log(error.response.data);