In my project, I am using Angular 7.1.4.
This is an excerpt from my effect code:
@Injectable()
export class LoginEffects {
constructor(private actions$: Actions, private authService: AuthenticationService) {}
@Effect({dispatch: true})
loginRequest$: Observable<any> = this.actions$.pipe(
ofType(LoginActionsType.LOGIN_REQUEST),
exhaustMap(payload => {
console.log(payload);
return this.authService.login(payload.user, payload.password)
.pipe(
map(user => new LoginSuccessAction(user)),
catchError(err => of(new LogOutAction(err)))
);
})
);
}
I encountered the following error: ERROR Error: Effect "LoginEffects.loginRequest$" dispatched an invalid action.
If I include {dispatch: false} in the @Effect decorator, the error disappears.
Furthermore, attempting to access payload properties results in TypeScript errors.