How do i make an api call first in redux action and then dispatch GET_TODOs?
// first the api call has to be made,
    export function getTodos() {
    return {
          type: 'GET_TODOS',
          promise: request.get(API_URL)
      }
    }
then it need to parse the response
// using https://github.com/Leonidas-from-XIV/node-xml2js
parseString(res, function (err, result) {
          // data gets parsed here
});
Then it has to send the raise the event. I tried as below but it is throwing error
const request = axios.get(url).then(res=>{
parseString(res, function (err, result) {
if(result){
      dispatch({
         type: GET_TODOS,
      data:result
    })
}
if(err) throw err
   });
}).catch(err=>console.error(error))
  };
I am getting below error
Error: Actions must be plain objects. Use custom middleware for async actions.
 
     
    