store
store copied to clipboard
How to detect when a dispatched action completes ?
This is a...
- [x] usage question
What toolchain are you using for transpilation/bundling?
- [x] @angular/cli
Environment
NodeJS Version: v8.11.2 Typescript Version: Angular Version: 6 @angular-redux/store version: 9.0.0 @angular/cli version: (if applicable) 6.0.8 OS: OSX
Additional Notes:
I would just like to know if it is possible to detect when an action completes, when using angular-redux. May be something like returning a promise... If yes, a small example will help a lot. Thanks in advance.
Whatever is acting on your action (in an Epic, I would assume) should dispatch another action indicating such.
ie.: Dispatch: DATA_REQUESTED Epic: Calls API and gets data Dispatch: DATA_RECEIVED
Your DAT_RECEIVED action can then be handled in your reducer. I have used this method in the past for busy indicators.