I can't see a clear way to know when a particular action has fired or particular state has updated from the context of a redux-thunk action creator.
I want to do something like this:
- Dispatch an action
- Detect a possible recoverable error condition
- Error condition dispatches a different action signalling recovery process initiating
- Wait for recovery to complete
- Proceed with current action or re-dispatch it
Concrete example:
- User interaction triggers API call action
- Note that API call failed, needs login
- Dispatch 'LOGIN_REQUIRED' action, which pops up a
<dialog>
for user. - Wait for logged in state to change (or LOGIN_SUCCESS action to occur, whatever).
- Make same API call again