Add category rename and drag-and-drop reordering in edit mode
- Edit toggle behind the "Kategorien" title enables an edit mode. - In edit mode all category tiles become inline rename fields (no outline, distinct background, small margins); articles and "new article" are hidden. - Rename via PATCH /api/category/:id; reorder via PUT /api/category/order (parentId + categoryIds) with SortableJS. - Only call backend when order actually changed; revert DOM order on error so further dragging keeps working. - Redux: renameCategory + reorderCategories thunks, renameMode state.
This commit is contained in:
@@ -345,6 +345,20 @@ export const category = {
|
||||
body: { name },
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* PUT /api/category/order
|
||||
* Body: { parentId, categoryIds: number[] } — sibling order of the children
|
||||
* under `parentId` (top-down). categoryIds must be exactly the current child
|
||||
* set of parentId (same count, no foreign/duplicate ids) → 400 Invalid category order.
|
||||
* → 200 { categoryIds: number[] }
|
||||
*/
|
||||
reorder(parentId, categoryIds) {
|
||||
return http('/api/category/order', {
|
||||
method: 'PUT',
|
||||
body: { parentId, categoryIds },
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user