Angular Redux: Console Error with Effects
Здравейте! Имам следната конзолна грешка: "PostEffects.allPosts$" dispatched an invalid action:, която ми е малко непонятна?
Имам следните екшъни:
export class GetAll implements IAction<null> {
type = ActionTypes.GetAll;
constructor(public payload: null) { }
}
export class GetAllSuccess implements IAction<PostInfo[]> {
type = ActionTypes.GetAllSuccess;
constructor(public payload: PostInfo[]) { }
}
export class GetAllFailed implements IAction<{ error: any }> {
type = ActionTypes.GetAllFailed;
constructor(public payload: { error: any }) { }
}
Това е ми е ефекта:
@Effect() allPosts$ = this.actions$.pipe(
ofType<GetAll>(ActionTypes.GetAll),
switchMap(() => {
return this.postService.getAll().pipe(
map((posts) => [new GetAllSuccess(posts)]),
catchError((err) => [new GetAllFailed({error: err.error})])
);
})
);
I was also interested in programming, but at some point I stopped liking it. instead, I became interested in the service https://bestresearchpaper.com/
Gmail Einloggen