summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole3/frontend/src/app/app.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'admin/WebConsole3/frontend/src/app/app.component.ts')
-rw-r--r--admin/WebConsole3/frontend/src/app/app.component.ts48
1 files changed, 29 insertions, 19 deletions
diff --git a/admin/WebConsole3/frontend/src/app/app.component.ts b/admin/WebConsole3/frontend/src/app/app.component.ts
index be41ce31..64d16e05 100644
--- a/admin/WebConsole3/frontend/src/app/app.component.ts
+++ b/admin/WebConsole3/frontend/src/app/app.component.ts
@@ -1,33 +1,43 @@
-import { Component, OnInit } from '@angular/core';
+import {Component, OnInit} from '@angular/core';
import {LayoutService, LayoutState, LayoutStore} from 'angular-admin-lte';
import {AuthModule, GlobunetUser} from 'globunet-angular/core';
import {TranslateService} from '@ngx-translate/core';
import {OgCommonService} from './service/og-common.service';
import {AdminLteConf} from './admin-lte.conf';
+import {User, UserPreferences} from './model/user';
@Component({
- selector: 'app-root',
- templateUrl: './app.component.html',
- styleUrls: ['./app.component.css']
+ selector: 'app-root',
+ templateUrl: './app.component.html',
+ styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
-public isCustomLayout: boolean;
+ public isCustomLayout: boolean;
- constructor(private layoutService: LayoutService, private layoutStore: LayoutStore, private adminLteConfig: AdminLteConf, private authModule: AuthModule, private translate: TranslateService, private ogCommonService: OgCommonService) {
+ constructor(private layoutService: LayoutService, private layoutStore: LayoutStore, private adminLteConfig: AdminLteConf, private authModule: AuthModule, private translate: TranslateService, private ogCommonService: OgCommonService) {
- translate.setDefaultLang('en');
- translate.use('es');
- this.ogCommonService.loadEngineConfig();
- }
+ translate.setDefaultLang('en');
+ translate.use('es');
+ }
- ngOnInit() {
- this.layoutService.isCustomLayout.subscribe((value: boolean) => {
- this.isCustomLayout = value;
- });
- this.layoutStore.setSidebarLeftMenu(this.adminLteConfig.get().sidebarLeftMenu);
- }
+ ngOnInit() {
+ if (this.userIsLogged()) {
+ this.ogCommonService.loadEngineConfig().subscribe(
+ data => {
- userIsLogged(): boolean {
- return (this.authModule.getLoggedUser() && this.authModule.getLoggedUser().id !== 0);
- }
+ const user = <User>this.authModule.getLoggedUser();
+ this.ogCommonService.loadUserConfig();
+
+ this.layoutService.isCustomLayout.subscribe((value: boolean) => {
+ this.isCustomLayout = value;
+ });
+ this.layoutStore.setSidebarLeftMenu(this.adminLteConfig.get().sidebarLeftMenu);
+ }
+ );
+ }
+ }
+
+ userIsLogged(): boolean {
+ return (this.authModule.getLoggedUser() && this.authModule.getLoggedUser().id !== 0);
+ }
}