After implementing a new effect for the register action, I encountered the following error message: Effect "AuthEffects.register$" dispatched an invalid action
Below is the code for my effect:
@Effect()
register$ = this.actions$.pipe(
ofType<Register>(AuthActionTypes.Register),
map(action => action.payload),
exhaustMap((register: RegisterModel) =>
this.authService
.register(register)
.pipe(
tap(status => new RegisterSuccess(status)),
catchError(error => of(new RegisterFailure(error)))
)
)
);
This is the implementation of the RegisterSuccess action:
export class RegisterSuccess implements Action {
readonly type = AuthActionTypes.RegisterSuccess;
constructor(public payload: boolean) {}
}
The RegisterSuccess action returns a boolean value indicating the success of the registration process. Here is the relevant section of the reducer:
case AuthActionTypes.RegisterSuccess: {
return {
...state,
error: null,
success: action.payload
}
}
It appears that the issue lies in the reducer. The effect and action seem to be correctly implemented. Is there a problem with my reducer logic? Thank you for your assistance!