u
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user