icon load function

This commit is contained in:
Kyle Spearrin 2018-11-15 16:55:54 -05:00
parent da47faca5c
commit e13f317aad
1 changed files with 9 additions and 5 deletions

View File

@ -37,7 +37,7 @@ export class IconComponent implements OnChanges {
private iconsUrl: string;
constructor(private environmentService: EnvironmentService, private stateService: StateService) {
constructor(environmentService: EnvironmentService, protected stateService: StateService) {
this.iconsUrl = environmentService.iconsUrl;
if (!this.iconsUrl) {
if (environmentService.baseUrl) {
@ -49,8 +49,16 @@ export class IconComponent implements OnChanges {
}
async ngOnChanges() {
console.log('load it changes');
this.imageEnabled = !(await this.stateService.get<boolean>(ConstantsService.disableFaviconKey));
this.load();
}
get iconCode(): string {
return IconMap[this.icon];
}
protected load() {
switch (this.cipher.type) {
case CipherType.Login:
this.icon = 'fa-globe';
@ -70,10 +78,6 @@ export class IconComponent implements OnChanges {
}
}
get iconCode(): string {
return IconMap[this.icon];
}
private setLoginIcon() {
if (this.cipher.login.uri) {
let hostnameUri = this.cipher.login.uri;