Skip to content

Commit

Permalink
chore: Add check empty lang
Browse files Browse the repository at this point in the history
  • Loading branch information
EndyKaufman committed Apr 8, 2019
1 parent 9914202 commit 3c5cd66
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions apps/demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,43 @@ export class AppComponent implements OnInit, OnDestroy {
this.languages$ = this._langService.languages$;
this.currentLang$ = this._langService.current$;
this.currentUser$ = this._authService.current$;

this._platform.ready().then(() => {
this.currentLang$
.pipe(takeUntil(this._destroyed$))
.subscribe(lang => {
this.currentLang$
.pipe(takeUntil(this._destroyed$))
.subscribe(lang => {
if (lang) {
this._metaService.setTag(
'og:locale',
lang.toLowerCase() + '-' + lang.toUpperCase()
);
this.title = this._translateService.instant(
this._metaService.loader.settings.applicationName
);
});
this.currentUser$
.pipe(takeUntil(this._destroyed$))
.subscribe(user => {
if (user) {
if (user.permissionNames.includes('read_group')) {
this._groupsService.repository.reloadAll();
}
if (user.permissionNames.includes('read_permission')) {
this._permissionsService.repository.reloadAll();
}
}
});
this.currentUser$
.pipe(takeUntil(this._destroyed$))
.subscribe(user => {
if (user) {
if (user.permissionNames.includes('read_group')) {
this._groupsService.repository.reloadAll();
}
});
if (isPlatformBrowser(this._platformId)) {
this._tokenService.tokenHasExpired$.pipe(takeUntil(this._destroyed$)).subscribe(result => {
if (result === true) {
if (isPlatformBrowser(this._platformId)) {
this._authModalService.onTokenError();
} else {
this._authModalService.onSignOutSuccess(undefined);
}
if (user.permissionNames.includes('read_permission')) {
this._permissionsService.repository.reloadAll();
}
});
}
}
});
if (isPlatformBrowser(this._platformId)) {
this._tokenService.tokenHasExpired$.pipe(takeUntil(this._destroyed$)).subscribe(result => {
if (result === true) {
if (isPlatformBrowser(this._platformId)) {
this._authModalService.onTokenError();
} else {
this._authModalService.onSignOutSuccess(undefined);
}
}
});
}
this._platform.ready().then(() => {
this._statusBar.styleDefault();
this._splashScreen.hide();
});
Expand Down

0 comments on commit 3c5cd66

Please sign in to comment.