How can I call openSnackbar function if response is empty but return LoadUserSuccess if response is not empty. I can't seem to find a solution that works.
@Effect()
validateOtp$: Observable<Action> = this.actions$.pipe(
ofType<otpActions.Otp>(otpActions.OTP),
switchMap((action) => {
return this.otpService.validateOtp(action.payload).pipe(
map(
(response) => new userActions.LoadUserSucess(response)
// this.openSnackBar()
)
);
})
);
openSnackBar() {
this.snackBar.open('Code invalid / expired', 'Close', {
duration: 3500,
});
}
Simply follow the example below: