TSK-1214: Removed unneccessary copies and GET call

This commit is contained in:
Tristan Eisermann 2020-06-17 13:05:55 +02:00 committed by Mustapha Zorgati
parent 7b5927d281
commit dbdf3e6b03
2 changed files with 4 additions and 12 deletions

View File

@ -242,7 +242,6 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
return `custom${customNumber}`; return `custom${customNumber}`;
} }
// TODO: Remove when classification is in store
getAvailableCategories(type: string) { getAvailableCategories(type: string) {
let returnCategories: string[] = []; let returnCategories: string[] = [];
this.classificationTypes$.pipe(take(1)).subscribe(classTypes => { this.classificationTypes$.pipe(take(1)).subscribe(classTypes => {

View File

@ -83,7 +83,7 @@ export class ClassificationState implements NgxsAfterBootstrap {
classification.children = !classification.children ? [] : classification.children; classification.children = !classification.children ? [] : classification.children;
}); });
ctx.patchState({ ctx.patchState({
classifications: [...classifications] classifications
}); });
}), }),
); );
@ -159,16 +159,9 @@ export class ClassificationState implements NgxsAfterBootstrap {
@Action(UpdateClassification) @Action(UpdateClassification)
updateClassification(ctx: StateContext<ClassificationStateModel>, action: SaveClassification): Observable<any> { updateClassification(ctx: StateContext<ClassificationStateModel>, action: SaveClassification): Observable<any> {
return this.classificationsService.putClassification(action.classification).pipe( return this.classificationsService.putClassification(action.classification).pipe(take(1), tap(
// TODO remove this call when backend is fixed modified dates are not same classifications => ctx.patchState({ classifications })
take(1), tap(() => this.classificationsService.getClassifications(ctx.getState().selectedClassificationType).subscribe( ));
classifications => {
ctx.patchState({
classifications
});
}
))
);
} }
// initialize after Startup service has configured the taskanaRestUrl properly. // initialize after Startup service has configured the taskanaRestUrl properly.