Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular “效果”;AuthEffects.register$”;发送了一个无效的操作_Angular_Typescript_Ngrx_Ngrx Store_Ngrx Effects - Fatal编程技术网

Angular “效果”;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“AuthEffects.register$”调度了一个无效操作

这就是我的效果:

@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)))
        )
    )
);