I need help resolving the following warning message:
ESLint: Calling 'store.dispatch' in 'Effect' is not allowed.
The specific effect I am working with performs the following tasks:
- Locks data in the store using a reducer
- Updates the backend data
- Unlocks the data
Here is the code snippet:
this.actions$.pipe(
ofType(actions.update),
switchMap(action => {
this.store.dispatch(actions.lockData(action.data.id));
return this.backendService.update$(action.data)
.pipe(
map(...),
catchError(...),
finalize(()=> this.store.dispatch(actions.unlockData(action.data.id))
)
What would be the correct way to address this issue?