问题描述
这就是我想要做的。
在延迟加载的BookmarksModule
功能模块下,我的效果是侦听authActions.loginSuccess
中的AuthModule
,而w / c没有延迟加载。 / p>
@Injectable({
providedIn: 'root',})
export class FavoriteEffects {
getFavoriteAfterLogin$ = createEffect(
() => {
return this.actions$.pipe(
ofType(authActions.loginSuccess),map(() => favoriteActions.getFavorites())
);
}
);
这是authActions.loginSuccess
的分配方式。
loginCallback$ = createEffect(() => {
return this.actions$.pipe(
ofType(authActions.loginCallback),exhaustMap(() =>
this.authService.currentUser$.pipe(
map(currentUser => authActions.loginSuccess({ currentUser })),catchError(error =>
of(authActions.loginFailure({ error: error?.error?.message }))
)
)
)
);
});
loginSuccessRedirect$ = createEffect(
() => {
return this.actions$.pipe(
ofType(authActions.loginSuccess),tap(() => this.router.navigate([this.redirects.login.success]))
);
},{ dispatch: false }
);
如您所见,当分派authActions.loginSuccess
时,它被同一类中的loginSuccessRedirect$
正确地拦截了,但是这个动作在延迟加载的模块中没有被拦截吗?
功能模块的update-reducers
操作似乎已被分派之后 loginSuccess
操作已经被分派。
我该如何解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)