DEV Community

mansoorlive
mansoorlive

Posted on

Angular Not Redirecting After Getting Auth Token

Dear Experts Angular, Please See The Code Below And Tell Me Is It Correct or Wrong ?

 onFormSubmit() { this.isLoadingResults = true; this.authService.login(this.loginForm.value).subscribe(data => { this.isLoadingResults = false; this.router.navigate(['/secure'],{ replaceUrl: true }).then(_ => console.log('You are secure now!')); }, (err: any) => { console.log(err); this.isLoadingResults = false; }); } 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)