Angular “效果”;AuthEffects.register$”;发送了一个无效的操作
我为注册操作添加了新效果,但出现以下错误:effect“AuthEffects.register$”调度了一个无效操作 这就是我的效果:Angular “效果”;AuthEffects.register$”;发送了一个无效的操作,angular,typescript,ngrx,ngrx-store,ngrx-effects,Angular,Typescript,Ngrx,Ngrx Store,Ngrx Effects,我为注册操作添加了新效果,但出现以下错误:effect“AuthEffects.register$”调度了一个无效操作 这就是我的效果: @Effect() register$ = this.actions$.pipe( ofType<Register>(AuthActionTypes.Register), map(action => action.payload), exhaustMap((register: RegisterModel) =>
@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)))
)
)
);
它返回一个表示寄存器是否成功的布尔值。
这是一种情况:
case AuthActionTypes.RegisterSuccess: {
return {
...state,
error: null,
success: action.payload
}
}
问题在哪里?效果看起来不错,动作也不错,是不是我的减速机出了问题?
谢谢 您的
点击
应该是映射
,以便返回操作
@Effect()
register$ = this.actions$.pipe(
ofType<Register>(AuthActionTypes.Register),
map(action => action.payload),
exhaustMap((register: RegisterModel) =>
this.authService
.register(register)
.pipe(
map(status => new RegisterSuccess(status)),
catchError(error => of(new RegisterFailure(error)))
)
)
);
@Effect()
注册$=此.actions$.pipe(
ofType(AuthActionTypes.Register),
映射(action=>action.payload),
排气图((寄存器:寄存器模型)=>
这是authService
.登记册(登记册)
.烟斗(
映射(状态=>new RegisterSuccess(状态)),
catchError(error=>of(新寄存器失败(error)))
)
)
);
@Effect()
register$ = this.actions$.pipe(
ofType<Register>(AuthActionTypes.Register),
map(action => action.payload),
exhaustMap((register: RegisterModel) =>
this.authService
.register(register)
.pipe(
map(status => new RegisterSuccess(status)),
catchError(error => of(new RegisterFailure(error)))
)
)
);