Commit d6b72c4f authored by Lukas Burgey's avatar Lukas Burgey

Add handling of a server error for the info endpoint

parent 8ce12a45
...@@ -20,6 +20,9 @@ export class LoginComponent { ...@@ -20,6 +20,9 @@ export class LoginComponent {
) { ) {
this.userService.getIdPPreference().subscribe( this.userService.getIdPPreference().subscribe(
(allAuthInfo: AllAuthInfo) => { (allAuthInfo: AllAuthInfo) => {
if (allAuthInfo === null) {
return;
}
this.idps = allAuthInfo.idps; this.idps = allAuthInfo.idps;
this.selectedIdP = allAuthInfo.selected; this.selectedIdP = allAuthInfo.selected;
} }
......
...@@ -35,6 +35,12 @@ export class UserService { ...@@ -35,6 +35,12 @@ export class UserService {
this.cookieService.set(environment.idpCookieName, String(idp.id)); this.cookieService.set(environment.idpCookieName, String(idp.id));
} }
public errorHandler(error: any): void {
if (error.status === 500) {
this.snackBar.open('Server Error');
}
}
public getIdPPreference(): Observable<AllAuthInfo> { public getIdPPreference(): Observable<AllAuthInfo> {
let idpID = Number(this.cookieService.get(environment.idpCookieName)); let idpID = Number(this.cookieService.get(environment.idpCookieName));
...@@ -55,6 +61,11 @@ export class UserService { ...@@ -55,6 +61,11 @@ export class UserService {
selected: selected, selected: selected,
}; };
} }
).catch(
(error: any) => {
this.errorHandler(error);
return Observable.of(null);
}
); );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment