axios.post("/api/end", {data : "xx"})
.then(({ data }) => {
// doing something with success
})
.catch((err) => {
let message = typeof err.response !== "undefined" ? err.response.data.message : err.message;
console.warn("error", message);
});
axios.post('/formulas/create', {
name: "",
parts: ""
})
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error.response)
});
axios.get('/foo')
.catch(function (error) {
if (error.response) {
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
}
});
axios.post('/formulas/create', {
name: "",
parts: ""
})
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error.response)
});
axios.get(...).catch( error => { return Promise.reject(error.response.data.error); });