From 0154b0510e01e5c848c4ace678dcb78bfcff2d3a Mon Sep 17 00:00:00 2001 From: Mustapha Zorgati <15628173+mustaphazorgati@users.noreply.github.com> Date: Wed, 15 Apr 2020 14:50:01 +0200 Subject: [PATCH] TSK-1193: delayed initalisation of store until environment is set properly --- .../classifications/classification-categories.service.ts | 5 +---- .../app/store/classification-store/classification.state.ts | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/web/src/app/shared/services/classifications/classification-categories.service.ts b/web/src/app/shared/services/classifications/classification-categories.service.ts index 6075385e6f..118cab0f1a 100644 --- a/web/src/app/shared/services/classifications/classification-categories.service.ts +++ b/web/src/app/shared/services/classifications/classification-categories.service.ts @@ -15,14 +15,11 @@ export interface CategoriesResponse { [key: string]: string[] } @Injectable() export class ClassificationCategoriesService { - private mainUrl = environment.taskanaRestUrl; - private urlCategoriesByType = `${this.mainUrl}/v1/classifications-by-type`; - constructor(private httpClient: HttpClient) {} // TODO: convert to Map (maybe via ES6) getClassificationCategoriesByType(): Observable { - return this.httpClient.get(this.urlCategoriesByType); + return this.httpClient.get(`${environment.taskanaRestUrl}/v1/classifications-by-type`); } getCustomisation(): Observable { diff --git a/web/src/app/store/classification-store/classification.state.ts b/web/src/app/store/classification-store/classification.state.ts index 9b0a777e36..400a66f88f 100644 --- a/web/src/app/store/classification-store/classification.state.ts +++ b/web/src/app/store/classification-store/classification.state.ts @@ -34,7 +34,8 @@ export class ClassificationState { ); } - ngxsOnInit(ctx: StateContext): void { + // initialize after Startup service has configured the taskanaRestUrl properly. + ngxsAfterBootstrap(ctx: StateContext): void { ctx.dispatch(new InitializeStore()); } }