1axios.post("/api/end", {data : "xx"})
2 .then(({ data }) => {
3 // doing something with success
4 })
5 .catch((err) => {
6 let message = typeof err.response !== "undefined" ? err.response.data.message : err.message;
7 console.warn("error", message);
8});
1 .catch(function (error) {
2 if (error.response) {
3 console.log(error.response.data);
4 console.log(error.response.status);
5 console.log(error.response.headers);
6 }
1axios.get('/api/xyz/abcd')
2 .catch(function (error) {
3 if (error.response) {
4 // Request made and server responded
5 console.log(error.response.data);
6 console.log(error.response.status);
7 console.log(error.response.headers);
8 } else if (error.request) {
9 // The request was made but no response was received
10 console.log(error.request);
11 } else {
12 // Something happened in setting up the request that triggered an Error
13 console.log('Error', error.message);
14 }
15
16 });
1axios.get('/api/xyz/abcd')
2 .catch(function (error) {
3 if (error.response) {
4 // Request made and server responded
5 console.log(error.response.data);
6 console.log(error.response.status);
7 console.log(error.response.headers);
8 } else if (error.request) {
9 // The request was made but no response was received
10 console.log(error.request);
11 } else {
12 // Something happened in setting up the request that triggered an Error
13 console.log('Error', error.message);
14 }
15
16 });
17
1axios.post('/formulas/create', {
2 name: "",
3 parts: ""
4})
5.then(response => {
6 console.log(response)
7})
8.catch(error => {
9 console.log(error.response)
10});