From d114ba16c3fc67c92c91c76b4fe97d33a9f47650 Mon Sep 17 00:00:00 2001 From: ThomasFransolet Date: Sun, 18 Aug 2019 18:41:31 +0200 Subject: [PATCH] CP Fixing undefined language bug --- src/app/app.component.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 68d3ff7..6c3f697 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -82,10 +82,14 @@ export class AppComponent implements OnInit { this.Password = null; this._authService.IsLoggedIn = true; console.log(this.ConnectedUser.language); - if (this.ConnectedUser.language === 'gb') { + if (this.ConnectedUser.language === null) { this._translateService.setDefaultLang('en'); } else { - this._translateService.setDefaultLang(this.ConnectedUser.language); + if (this.ConnectedUser.language === 'gb') { + this._translateService.setDefaultLang('en'); + } else { + this._translateService.setDefaultLang(this.ConnectedUser.language); + } } } else { this._translateService.setDefaultLang('en'); @@ -173,6 +177,7 @@ export class AppComponent implements OnInit { public CreateProfile() { if (this.CorrectForm()) { this.CreateUser.deviceIds = []; + this.CreateUser.language = 'gb'; this._userService.CreateUser(this.CreateUser) .subscribe(