axios post data as query code example
Example 1: axios post with header
// Send a POST request
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
},
headers: {'Authorization': 'Bearer ...'}
});
Example 2: how to send data in query param in axios in get request
const res = await axios.get('https://httpbin.org/get', { params: { answer: 42 } });