diff --git a/Frontend Angular 4/src/app/layout/archivos/archivos.component.ts b/Frontend Angular 4/src/app/layout/archivos/archivos.component.ts index 94229216a1bb2f3008f7693f92b014ccc1bb5a08..718241f6fb46b2ad7e2b09bd7b2f79ba0b7aca63 100755 --- a/Frontend Angular 4/src/app/layout/archivos/archivos.component.ts +++ b/Frontend Angular 4/src/app/layout/archivos/archivos.component.ts @@ -158,6 +158,12 @@ export class ArchivosComponent { */ modalSeeScoreOpened = true; + private notificationTypeDictonarty = { + error: (message: string) => this.notifService.error(message), + success: (message: string) => this.notifService.success(message), + warning: (message: string) => this.notifService.warning(message), + }; + constructor( private router: Router, private notifService: NotificacionService, @@ -209,6 +215,13 @@ export class ArchivosComponent { } this.ordenarArchivos(); } + + showNotification(type: "error" | "success" | "warning", traslation: string) { + this.translateService + .get(traslation) + .subscribe(this.notificationTypeDictonarty[type]); + } + ordenarMixto() { //1. primero las carpetas. this.archivosCompartidosSinDuplicados = @@ -296,9 +309,7 @@ export class ArchivosComponent { mostrarEliminarDialogo() { // Chequear si se seleccionó un archivo if (!this.archivoSeleccionado) { - this.notifService.warning( - this.translateService.get("i18n.warning.file.noSelected").value - ); + this.showNotification("warning", "i18n.warning.file.noSelected"); return; } @@ -658,9 +669,7 @@ export class ArchivosComponent { */ confirmFileMove(event: CustomEvent) { if (!this.archivoSeleccionado) { - this.notifService.warning( - this.translateService.get("i18n.warning.file.noSelected").value - ); + this.showNotification("warning", "i18n.warning.file.noSelected"); return; }