remove 'if' from cat_change

breaks adding/removing categories
This commit is contained in:
alicia pritchett 2021-09-29 11:04:42 -04:00
parent 8e2b7c24a7
commit 35785caa2e

View File

@ -220,14 +220,12 @@ export class WorkflowSpecListComponent implements OnInit {
editCategoryDisplayOrder(catId: number, direction: string) { editCategoryDisplayOrder(catId: number, direction: string) {
this.api.reorderWorkflowCategory(catId, direction).subscribe(cat_change => { this.api.reorderWorkflowCategory(catId, direction).subscribe(cat_change => {
if(cat_change) {
this.workflowSpecsByCategory = this.workflowSpecsByCategory.map(cat => { this.workflowSpecsByCategory = this.workflowSpecsByCategory.map(cat => {
let new_cat = cat_change.find(i2 => i2.id === cat.id); let new_cat = cat_change.find(i2 => i2.id === cat.id);
cat.display_order = new_cat.display_order; cat.display_order = new_cat.display_order;
return cat; return cat;
}); });
this.workflowSpecsByCategory.sort((x,y) => x.display_order - y.display_order); this.workflowSpecsByCategory.sort((x,y) => x.display_order - y.display_order);
}
}); });
} }