axios query params post code example
Example 1: axios pass params
const axios = require('axios');
const res = await axios.get('https://httpbin.org/get', { params: { answer: 42 } });
res.data.args;
Example 2: axios get status code
axios.get('/foo')
.catch(function (error) {
if (error.response) {
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
}
});
Example 3: how to send data in query param in axios in get request
const res = await axios.get('https://httpbin.org/get', { params: { answer: 42 } });