svrcekmichal / redux-axios-middleware

Redux middleware for fetching data with axios HTTP client
MIT License
920 stars 96 forks source link

takeEvery/takeLatest are not catching *_SUCCESS or *_FAIL actions #79

Closed iamtakingiteasy closed 6 years ago

iamtakingiteasy commented 6 years ago

For some reason when i have an action like USER/LOGIN, i can't do anything like

yield takeEvery('USER/LOGIN_SUCCESS', mySaga);

However,

yield takeEvery('USER/LOGIN', mySaga);

in my saga works just fine, but obviously at the moment request is dispatched, not successfully finished. I've added a monitoring reducer and USER/LOGIN_SUCCESS is indeed dispatched, but takeEvery doesn't seem to care. Any ideas why?

nmaves commented 6 years ago

You really should post your code here for us to help you.

My best guess is that you have your middleware out of order.

iamtakingiteasy commented 6 years ago

Yes, you're right. After i've placed my sagaMiddleware after axiosMiddleware every _SUCCESS and _FAIL action started to catch up with takeEvery/takeLast as any other action. Thank you, never would thought that order of middlewares matters!

nmaves commented 6 years ago

Not a problem, glad I could help.