trying to call two api's in an action. When one is complete call the other then on the last one pass it off to a reducer. Looks like my getAttending is getting called at the same time as post and not after post is completed. I'm new to redux-thunk and thought I could just call them one after another as the completed.
export function postDeclined(id){
let post = axios.post(blaBla.com);
let getAttending = axios.get(attending.com);
return (dispatch) => {
post.then(()=>{
getAttending.then(({data})=>{
dispatch({
type: type.NOT_GOING,
payload: data.data
});
});
});
}
}
Try doing the api calls like this:
When you "declared" the calls, you were actually calling the API... so it was doing async...