我一直收到以下错误:
如下所示:
我该如何解决?登录会按预期进行,但我不确定如何解决该问题:
auth.effects.ts
b.execute_script('document.getElementById("contenteditable-root").innerHTML = "hi";')
auth.actions.ts
@Effect()
googleSignIn = this.actions.pipe(
ofType(authActions.googleSignIn),
mergeMap(() =>
from(this.authService.googleSignIn()).pipe(
map(() => this.getAuthData,
catchError(err =>
of({ error: err.message })
)
)
)
)
);
@Effect()
getAuthData = this.actions.pipe(
ofType(authActions.getAuthData),
mergeMap(() => (
this.afAuth.authState.pipe(
map((authData: AuthState) => {
if (authData) {
const parsedAuthData: Partial<AuthState> = this.authService.parseAuthData(authData);
return authActions.authDataRetrieved({ payload: parsedAuthData });
} else {
return authActions.authDataNotRetrieved();
}
}),
catchError(error => {
this.logger.debug(error);
return of(authActions.authError({ errorMessage: error.message, errorCode: error.code }));
})
)
)
)
);
答案 0 :(得分:1)
您应该从googleSignIn效果中返回一个操作,诸如此类
getPosts$ = createEffect(() =>
this.actions$.pipe(
ofType(PostActions.LoadPosts),
switchMap(_ => {
return this.postService
.getPosts()
.pipe(
map(
(posts: IPost[]) => PostActions.LoadPostsSuccess({ posts }), // return an action here
catchError(errors => of(PostActions.LoadPostsFail(errors)))
)
);
})
)
);
我指出您的错误在哪里,以便您可以解决
@Effect()
googleSignIn = this.actions.pipe(
ofType(authActions.googleSignIn),
mergeMap(() =>
from(this.authService.googleSignIn()).pipe(
map(() => this.getAuthData, // you need to return an action here
catchError(err =>
of({ error: err.message })
)
)
)
)
);