From ba430d7516bc5b1324b60571ba7594460969b7fb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 18 Dec 2019 15:31:54 +0100 Subject: Lazy load static objects --- client/src/app/+my-account/my-account.component.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'client/src/app/+my-account/my-account.component.ts') diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts index d98d06f8e..05dcf522d 100644 --- a/client/src/app/+my-account/my-account.component.ts +++ b/client/src/app/+my-account/my-account.component.ts @@ -1,20 +1,28 @@ -import { Component } from '@angular/core' +import { Component, OnInit } from '@angular/core' import { ServerService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' import { TopMenuDropdownParam } from '@app/shared/menu/top-menu-dropdown.component' +import { ServerConfig } from '@shared/models' @Component({ selector: 'my-my-account', templateUrl: './my-account.component.html', styleUrls: [ './my-account.component.scss' ] }) -export class MyAccountComponent { +export class MyAccountComponent implements OnInit { menuEntries: TopMenuDropdownParam[] = [] + private serverConfig: ServerConfig + constructor ( private serverService: ServerService, private i18n: I18n - ) { + ) { } + + ngOnInit (): void { + this.serverConfig = this.serverService.getTmpConfig() + this.serverService.getConfig() + .subscribe(config => this.serverConfig = config) const libraryEntries: TopMenuDropdownParam = { label: this.i18n('My library'), @@ -91,7 +99,7 @@ export class MyAccountComponent { } isVideoImportEnabled () { - const importConfig = this.serverService.getConfig().import.videos + const importConfig = this.serverConfig.import.videos return importConfig.http.enabled || importConfig.torrent.enabled } -- cgit v1.2.3