TSK-1193: delayed initalisation of store until environment is set properly

This commit is contained in:
Mustapha Zorgati 2020-04-15 14:50:01 +02:00
parent eef64bc1b3
commit 0154b0510e
2 changed files with 3 additions and 5 deletions

View File

@ -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<CategoriesResponse> {
return this.httpClient.get<CategoriesResponse>(this.urlCategoriesByType);
return this.httpClient.get<CategoriesResponse>(`${environment.taskanaRestUrl}/v1/classifications-by-type`);
}
getCustomisation(): Observable<Customisation> {

View File

@ -34,7 +34,8 @@ export class ClassificationState {
);
}
ngxsOnInit(ctx: StateContext<ClassificationStateModel>): void {
// initialize after Startup service has configured the taskanaRestUrl properly.
ngxsAfterBootstrap(ctx: StateContext<ClassificationStateModel>): void {
ctx.dispatch(new InitializeStore());
}
}