u
This commit is contained in:
@@ -401,6 +401,28 @@ const actions = {
|
||||
return res.category;
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate a mosaic image for a category from its articles and subcategories.
|
||||
* @param {{ categoryId: number|string, size?: number }} param0
|
||||
*/
|
||||
async generateCategoryImage({ categoryId, size } = {}) {
|
||||
const res = await categoryApi.generateImage(categoryId, { size });
|
||||
const { id, fullHash, thumbW, thumbH, thumbHash } = res.category;
|
||||
const { categories } = categoryAutomat.state;
|
||||
if (!categories) return res.category;
|
||||
const key = String(id);
|
||||
const nextCategories = {
|
||||
...categories,
|
||||
[key]: { ...categories[key], fullHash, thumbW, thumbH, thumbHash },
|
||||
};
|
||||
categoryAutomat.setState({
|
||||
categories: nextCategories,
|
||||
});
|
||||
refreshCategoryViewChildren(nextCategories);
|
||||
return res.category;
|
||||
},
|
||||
|
||||
|
||||
// ─── Local state patches ───────────────────────────────────────────────────
|
||||
|
||||
/** Remove an article from all live category view lists (used after article deletion). */
|
||||
|
||||
Reference in New Issue
Block a user