问题描述
我不明白为什么我的应用程序登录时为什么在控制台中两次触发“导航”。
两个不同的控制台/网络条目中的内容相同:
{@context: "/contexts/Navigation",@id: "/navigations",@type: "hydra:Collection",…}
@context: "/contexts/Navigation"
@id: "/navigations"
@type: "hydra:Collection"
对我来说这是个问题。加载需要超过一秒钟的时间。
登录组件:
login() {
if (!this.loginForm.valid) { return; }
this.sessionService.login({
email: this.loginForm.get('email').value,password: this.loginForm.get('password').value
});
}
登录服务:
@action('Login')
login(loginCredentials: LoginFormState) {
this.loginError$.next(false);
this.sessionStore.setLoading(true);
this.http.post<LoginRequestResponse>(`${this.config.apiUrl}/login_check`,loginCredentials).pipe(
catchError((err: HttpErrorResponse) => {
this.loginError$.next(true);
return throwError(err);
}),finalize(() => this.sessionStore.setLoading(false)),).subscribe(data => {
this.setToken(data.token);
this.router.navigate(['cars']);
});
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)