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/shared/images/preview-upload.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'client/src/app/shared/images') diff --git a/client/src/app/shared/images/preview-upload.component.ts b/client/src/app/shared/images/preview-upload.component.ts index 44b78866e..f56f5b1f8 100644 --- a/client/src/app/shared/images/preview-upload.component.ts +++ b/client/src/app/shared/images/preview-upload.component.ts @@ -2,6 +2,7 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' import { ServerService } from '@app/core' +import { ServerConfig } from '@shared/models' @Component({ selector: 'my-preview-upload', @@ -24,6 +25,7 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { imageSrc: SafeResourceUrl allowedExtensionsMessage = '' + private serverConfig: ServerConfig private file: File constructor ( @@ -32,14 +34,18 @@ export class PreviewUploadComponent implements OnInit, ControlValueAccessor { ) {} get videoImageExtensions () { - return this.serverService.getConfig().video.image.extensions + return this.serverConfig.video.image.extensions } get maxVideoImageSize () { - return this.serverService.getConfig().video.image.size.max + return this.serverConfig.video.image.size.max } ngOnInit () { + this.serverConfig = this.serverService.getTmpConfig() + this.serverService.getConfig() + .subscribe(config => this.serverConfig = config) + this.allowedExtensionsMessage = this.videoImageExtensions.join(', ') } -- cgit v1.2.3