This commit is contained in:
seb
2026-10-20 23:25:47 +02:00
parent 70c7d5eff2
commit 07206674c1
5 changed files with 33 additions and 41 deletions

View File

@@ -213,8 +213,8 @@ const actions = {
* @param {{ parentId: number|string, name: string }} param0
*/
async createArticle({ parentId, name }) {
const res = await articleApi.create({ categoryId: parentId, name });
const created = res.article;
const { sku } = await articleApi.create({ categoryId: parentId, name });
const { article: created } = await articleApi.getBySku(sku);
if (created) appendArticlesToCategoryViews({ categoryId: parentId, articles: [created] });
return created;
},
@@ -228,8 +228,9 @@ const actions = {
if (list.length === 0) throw new Error('Keine Namen übergeben.');
const created = [];
for (const name of list) {
const res = await articleApi.create({ categoryId: parentId, name });
if (res.article) created.push(res.article);
const { sku } = await articleApi.create({ categoryId: parentId, name });
const { article: created1 } = await articleApi.getBySku(sku);
if (created1) created.push(created1);
}
appendArticlesToCategoryViews({ categoryId: parentId, articles: created });
return created;