Closed joecritch closed 8 years ago
API_CALL
action type, and handle that in middleware. You could add a property to your api call actions and look for that, rather than a type, in your middleware.Thanks, this is working well so far. I'll try and get an example put together for future reference.
Thanks, I'll close this issue, but feel free to keep commenting or open a new issue if you have more questions/suggestions.
I have two questions about implementing optimistic actions:
(1) For the asynchronous ADD_TODO action, is it only ADD_TODO that needs to be initially called by my own action creator? And the middleware handles the corresponding _COMPLETED and _FAILED dispatches?
(2) How would the
api.js
middleware handle multiple action types? (E.g. DELETE_TODO?) Would I need a separate middleware for every action type?Thanks in advance.