u
This commit is contained in:
@@ -103,6 +103,8 @@ export class ApiClient {
|
||||
create: (body) => this.#json('POST', '/api/warehouse', { body }),
|
||||
/** PATCH /api/warehouse/{id} → 200 { warehouse: Warehouse } */
|
||||
update: (id, body) => this.#json('PATCH', `/api/warehouse/${enc(id)}`, { body }),
|
||||
/** PUT /api/warehouse/order → 200 { warehouseIds: number[] } */
|
||||
order: (body) => this.#json('PUT', '/api/warehouse/order', { body }),
|
||||
/** DELETE /api/warehouse/{id} → 204 */
|
||||
delete: (id) => this.#empty('DELETE', `/api/warehouse/${enc(id)}`),
|
||||
};
|
||||
@@ -353,7 +355,7 @@ export class ApiClient {
|
||||
* `onHistory(history, total)` — returns `{ unwatch, setSkipAndOffset }`.
|
||||
*/
|
||||
historyWatch: (sku, onHistory) => this.watchArticleHistory(sku, onHistory),
|
||||
/** PATCH /api/article/{sku} — body: at least one of { name, unitamount, unitSi } */
|
||||
/** PATCH /api/article/{sku} — body: at least one of { name, unitamount, unitSi, track_stock } */
|
||||
update: async (sku, body) => {
|
||||
const nameChange = body != null && Object.hasOwn(body, 'name');
|
||||
if (nameChange) {
|
||||
@@ -400,6 +402,15 @@ export class ApiClient {
|
||||
/** PUT /api/article/{sku}/categories */
|
||||
setCategories: (sku, body) =>
|
||||
this.#json('PUT', `/api/article/${enc(sku)}/categories`, { body }),
|
||||
/** PUT /api/article/{sku}/track_stock */
|
||||
setTrackStock: async (sku, body) => {
|
||||
const payload = typeof body === 'boolean' ? { track_stock: body } : body;
|
||||
const res = await this.#json('PUT', `/api/article/${enc(sku)}/track_stock`, { body: payload });
|
||||
if (res?.article) {
|
||||
this.setArticle(res.article);
|
||||
}
|
||||
return res;
|
||||
},
|
||||
/** GET /api/article/{sku}/supplier */
|
||||
getSuppliers: (sku) => this.#json('GET', `/api/article/${enc(sku)}/supplier`),
|
||||
/** POST /api/article/{sku}/supplier */
|
||||
|
||||
Reference in New Issue
Block a user