Show article history in a table via GET /article/{sku}/history.
This commit is contained in:
@@ -106,8 +106,21 @@ export class ApiClient {
|
||||
exportZip: (query = {}) => this.#blob('GET', '/api/article/export.zip', { query }),
|
||||
/** GET /api/article/{sku} */
|
||||
get: (sku) => this.#json('GET', `/api/article/${enc(sku)}`),
|
||||
/** PATCH /api/article/{sku} */
|
||||
update: (sku, body) => this.#json('PATCH', `/api/article/${enc(sku)}`, { body }),
|
||||
/** GET /api/article/{sku}/history → { history: [{ id, date, text }, ...] } */
|
||||
history: (sku) => this.#json('GET', `/api/article/${enc(sku)}/history`),
|
||||
/** PATCH /api/article/{sku} — body: at least one of { name, unitamount, unitSi } */
|
||||
update: async (sku, body) => {
|
||||
const nameChange = body != null && Object.hasOwn(body, 'name');
|
||||
if (nameChange) {
|
||||
this.setArticleIndexName(sku, body.name);
|
||||
}
|
||||
try {
|
||||
return await this.#json('PATCH', `/api/article/${enc(sku)}`, { body });
|
||||
} catch (err) {
|
||||
if (nameChange) this.clearArticleIndex();
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
/** DELETE /api/article/{sku} */
|
||||
delete: (sku) => this.#empty('DELETE', `/api/article/${enc(sku)}`),
|
||||
/** PUT /api/article/{sku}/prices */
|
||||
|
||||
Reference in New Issue
Block a user