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});
11
1 try {
2 await axios.get('/bad-call')
3 } catch (error) {
4 const err = error as AxiosError
5 if (err.response) {
6 console.log(err.response.status)
7 console.log(err.response.data)
8 }
9 this.handleAxiosError(error)
10 }
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.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});