From f33c1e556aef8797f7c59d90f4e47eba8f48a35c Mon Sep 17 00:00:00 2001 From: HardiReady Date: Sat, 24 Nov 2018 14:12:05 +0100 Subject: [PATCH] Fix error message display for login page (CC-71) --- static/src/app/login/login.component.ts | 3 ++- .../services/user-interface/snack-bar/snack-bar.service.ts | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/static/src/app/login/login.component.ts b/static/src/app/login/login.component.ts index b5e48e6..35c93a9 100644 --- a/static/src/app/login/login.component.ts +++ b/static/src/app/login/login.component.ts @@ -38,7 +38,8 @@ export class LoginComponent implements OnInit { this.router.navigate([this.returnUrl]); }, error => { - this.snackBarService.showError(error._body, 15000); + // TODO: return i18n key from backend to use translate error method + this.snackBarService.showUntranslatedError(error.error, 15000); this.loading = false; }); } diff --git a/static/src/app/services/user-interface/snack-bar/snack-bar.service.ts b/static/src/app/services/user-interface/snack-bar/snack-bar.service.ts index f4c7842..2cd5565 100644 --- a/static/src/app/services/user-interface/snack-bar/snack-bar.service.ts +++ b/static/src/app/services/user-interface/snack-bar/snack-bar.service.ts @@ -42,4 +42,8 @@ export class SnackBarService { }); }); } + + showUntranslatedError(message: string, duration?: number) { + return this.show(message, 'OK', duration, ['custom-snack-bar', 'label-danger']); + } }