this.router.navigate未检测到Safari的任何更改

时间:2019-07-26 08:58:53

标签: angular

我正在尝试在服务器对登录呼叫返回true时打开仪表板,但是当用户输入电子邮件,密码并按登录时,它在服务器上发送呼叫得到响应但卡在了同一个登录屏幕上,它在chrome上可以正常工作,但不能在iOS Chrome和Safari浏览器

ngOnInit() {
  this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/dashboard';
}

doLogin() {
    console.log("Before server call");
    this.authService.doLogin(this.account.email, this.account.password).subscribe(
        response => {
              console.log("Server return response");
            if (response.success) {
                console.log("Before Navigate"+response.success);
                try{
                  this.router.navigate([this.returnUrl]);
                }catch(e){
                    console.log("catch block"+e);
                }
                  console.log("after Navigate");
            }
            else {
                console.log("success false"+response.message);
                this.messageService.showMessage('INVALID CREDENTIALS', null);
            }
        },
        error => {
            console.log("Error");
            this.messageService.showMessage('INVALID CREDENTIALS', null);
        }
    );
}

0 个答案:

没有答案