Clean up the error code when the OAuth user is not authorized.

This commit is contained in:
Jamie 2018-04-25 20:50:34 +01:00
commit d443efd8ea

View file

@ -2,6 +2,7 @@
import { ActivatedRoute, Router } from "@angular/router"; import { ActivatedRoute, Router } from "@angular/router";
import { AuthService } from "../auth/auth.service"; import { AuthService } from "../auth/auth.service";
import { NotificationService } from "../services";
@Component({ @Component({
templateUrl: "./loginoauth.component.html", templateUrl: "./loginoauth.component.html",
@ -11,7 +12,7 @@ export class LoginOAuthComponent implements OnInit {
public error: string; public error: string;
constructor(private authService: AuthService, private router: Router, constructor(private authService: AuthService, private router: Router,
private route: ActivatedRoute) { private route: ActivatedRoute, private notify: NotificationService) {
this.route.params this.route.params
.subscribe((params: any) => { .subscribe((params: any) => {
this.pin = params.pin; this.pin = params.pin;
@ -37,6 +38,10 @@ export class LoginOAuthComponent implements OnInit {
this.error = x.errorMessage; this.error = x.errorMessage;
} }
}, err => {
this.notify.error(err.statusText);
this.router.navigate(["login"]);
}); });
} }
} }