From 2371de3023ad665e17b3a55227ff4c047b0831c0 Mon Sep 17 00:00:00 2001 From: "mathias.chouet" <mathias.chouet@irstea.fr> Date: Thu, 13 Aug 2020 11:01:36 +0200 Subject: [PATCH] Get rid of unused ErrorService --- src/app/app.component.ts | 18 +----------------- src/app/services/error.service.ts | 12 ------------ 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 src/app/services/error.service.ts diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 364b60d6b..01ddce6dd 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -9,7 +9,6 @@ import { Observer, jalhydDateRev, jalhydVersion, CalculatorType, Session } from import { environment } from "../environments/environment"; import { I18nService } from "./services/internationalisation.service"; -import { ErrorService } from "./services/error.service"; import { FormulaireService } from "./services/formulaire.service"; import { FormulaireDefinition } from "./formulaire/definition/form-definition"; import { ServiceFactory } from "./services/service-factory"; @@ -46,8 +45,7 @@ declare let device: any; @Component({ selector: "nghyd-app", templateUrl: "./app.component.html", - styleUrls: ["./app.component.scss"], - providers: [ErrorService] + styleUrls: ["./app.component.scss"] }) export class AppComponent implements OnInit, OnDestroy, Observer { @@ -84,7 +82,6 @@ export class AppComponent implements OnInit, OnDestroy, Observer { constructor( private intlService: I18nService, private appSetupService: ApplicationSetupService, - private errorService: ErrorService, private router: Router, private formulaireService: FormulaireService, private httpService: HttpService, @@ -277,12 +274,10 @@ export class AppComponent implements OnInit, OnDestroy, Observer { */ ngOnInit() { this.formulaireService.addObserver(this); - this.subscribeErrorService(); this._innerWidth = window.innerWidth; } ngOnDestroy() { - this.unsubscribeErrorService(); this.formulaireService.removeObserver(this); } @@ -409,17 +404,6 @@ export class AppComponent implements OnInit, OnDestroy, Observer { return fits; } - /** - * abonnement au service d'erreurs - */ - private subscribeErrorService() { - this.errorService.addObserver(this); - } - - private unsubscribeErrorService() { - this.errorService.removeObserver(this); - } - public get enableHeaderDoc(): boolean { return this.currentRoute === "/list" && this._calculators.length === 0; } diff --git a/src/app/services/error.service.ts b/src/app/services/error.service.ts deleted file mode 100644 index 25288f4fe..000000000 --- a/src/app/services/error.service.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Injectable } from "@angular/core"; - -import { Observable } from "jalhyd"; - -@Injectable() -export class ErrorService extends Observable { - // TODO: add explicit constructor - - doAlert(m: string) { - this.notifyObservers(m); - } -} -- GitLab