I am trying to pass data in body of get type Api in react.js app. I am using the following code. But Api doesn't get any data.
getUnits = ( key, text, code, limit, offset ) => {
let data = JSON.stringify( { unit: { key, text, code, limit, offset } } );
let config = {
method: 'get',
url: BaseURL + 'unit',
headers: { 'Content-Type': 'application/json' },
data: data
};
axios( config ).then( res => {
store.dispatch( {
type: GET_UNIT,
payload: res.data.units
} )
} ).catch( err => {
console.log(err);
})
})
}