u
This commit is contained in:
@@ -482,6 +482,21 @@ export class ApiClient {
|
||||
/** DELETE /api/article/{sku}/property/{propertyId} */
|
||||
deleteProperty: (sku, propertyId) =>
|
||||
this.#json('DELETE', `/api/article/${enc(sku)}/property/${enc(propertyId)}`),
|
||||
/** POST /api/article/{sku}/father */
|
||||
toggleFather: (sku, body) =>
|
||||
this.#json('POST', `/api/article/${enc(sku)}/father`, { body }),
|
||||
/** GET /api/article/{sku}/children */
|
||||
getChildren: (sku) =>
|
||||
this.#json('GET', `/api/article/${enc(sku)}/children`),
|
||||
/** POST /api/article/{sku}/children */
|
||||
addChild: (sku, body) =>
|
||||
this.#json('POST', `/api/article/${enc(sku)}/children`, { body }),
|
||||
/** DELETE /api/article/{sku}/children/{childSku} */
|
||||
removeChild: (sku, childSku, { deleteArticle = false } = {}) =>
|
||||
this.#json(
|
||||
'DELETE',
|
||||
`/api/article/${enc(sku)}/children/${enc(childSku)}${deleteArticle ? '?deleteArticle=true' : ''}`
|
||||
),
|
||||
};
|
||||
|
||||
this.posterminal = {
|
||||
|
||||
@@ -479,6 +479,46 @@ export const article = {
|
||||
{ method: 'DELETE' }
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* POST /api/article/:sku/father
|
||||
* Body: { isFather: boolean, attributeNameId?: number }
|
||||
*/
|
||||
toggleFather(sku, body) {
|
||||
return http(`/api/article/${encodeURIComponent(sku)}/father`, {
|
||||
method: 'POST',
|
||||
body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* GET /api/article/:sku/children → { children: [...] }
|
||||
*/
|
||||
getChildren(sku) {
|
||||
return http(`/api/article/${encodeURIComponent(sku)}/children`);
|
||||
},
|
||||
|
||||
/**
|
||||
* POST /api/article/:sku/children
|
||||
* Body: { attributeValueId?: number, value?: string, name?: string }
|
||||
*/
|
||||
addChild(sku, body) {
|
||||
return http(`/api/article/${encodeURIComponent(sku)}/children`, {
|
||||
method: 'POST',
|
||||
body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* DELETE /api/article/:sku/children/:childSku
|
||||
*/
|
||||
removeChild(sku, childSku, options = {}) {
|
||||
const qs = options?.deleteArticle ? '?deleteArticle=true' : '';
|
||||
return http(
|
||||
`/api/article/${encodeURIComponent(sku)}/children/${encodeURIComponent(childSku)}${qs}`,
|
||||
{ method: 'DELETE' }
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user