Add category picker to article view with draft-based editing
- Add setCategories API method for PUT /api/article/:sku/categories - Create CategoryPickerDialog component for selecting categories - Add CategoryPills component with add/remove functionality - Category changes are now draft-based (like name editing) - Save button commits both name and category changes together - Delete icons hidden when only one category remains - Plus button only visible in edit mode Implements category assignment flow similar to name editing pattern.
This commit is contained in:
@@ -261,6 +261,19 @@ export const article = {
|
||||
body: { eans },
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* PUT /api/article/:sku/categories
|
||||
* Body: { categoryIds: number[] } — replace-all. Empty array clears all.
|
||||
* Categories must belong to the article's company; ids must be unique.
|
||||
* → 200 { article } (same shape as GET by SKU)
|
||||
*/
|
||||
setCategories(sku, categoryIds) {
|
||||
return http(`/api/article/${encodeURIComponent(sku)}/categories`, {
|
||||
method: 'PUT',
|
||||
body: { categoryIds },
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user