mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Migrate from window.console to LogService
This commit is contained in:
@@ -17,13 +17,7 @@
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import {
|
||||
AlfrescoTranslationService,
|
||||
AuthService,
|
||||
SettingsService,
|
||||
StorageService
|
||||
} from 'ng2-alfresco-core';
|
||||
import { AlfrescoTranslateService, AuthService, SettingsService, StorageService, LogService } from 'ng2-alfresco-core';
|
||||
|
||||
declare var document: any;
|
||||
|
||||
@@ -38,22 +32,23 @@ export class AppComponent {
|
||||
ecmHost: string = 'http://' + window.location.hostname + ':8080';
|
||||
bpmHost: string = 'http://' + window.location.hostname + ':9999';
|
||||
|
||||
constructor(public authService: AuthService,
|
||||
public router: Router,
|
||||
public settingsService: SettingsService,
|
||||
private translate: AlfrescoTranslationService,
|
||||
private storage: StorageService) {
|
||||
constructor(private authService: AuthService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: AlfrescoTranslateService,
|
||||
private storage: StorageService,
|
||||
private logService: LogService) {
|
||||
this.setEcmHost();
|
||||
this.setBpmHost();
|
||||
this.setProvider();
|
||||
|
||||
if (translate) {
|
||||
if (translateService) {
|
||||
if (process.env.ENV === 'production') {
|
||||
translate.addTranslationFolder('custom', 'i18n/custom-translation');
|
||||
translate.addTranslationFolder('ng2-alfresco-login', 'i18n/custom-translation/alfresco-login');
|
||||
translateService.addTranslationFolder('custom', 'i18n/custom-translation');
|
||||
translateService.addTranslationFolder('ng2-alfresco-login', 'i18n/custom-translation/alfresco-login');
|
||||
} else {
|
||||
translate.addTranslationFolder('custom', 'custom-translation');
|
||||
translate.addTranslationFolder('ng2-alfresco-login', 'custom-translation/alfresco-login');
|
||||
translateService.addTranslationFolder('custom', 'custom-translation');
|
||||
translateService.addTranslationFolder('ng2-alfresco-login', 'custom-translation/alfresco-login');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +79,7 @@ export class AppComponent {
|
||||
if (error && error.response && error.response.status === 401) {
|
||||
this.navigateToLogin();
|
||||
} else {
|
||||
console.error('An unknown error occurred while logging out', error);
|
||||
this.logService.error('An unknown error occurred while logging out', error);
|
||||
this.navigateToLogin();
|
||||
}
|
||||
}
|
||||
@@ -107,7 +102,7 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
changeLanguage(lang: string) {
|
||||
this.translate.use(lang);
|
||||
this.translateService.use(lang);
|
||||
this.hideDrawer();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user