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});
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.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 });