Watch article history over SSE so the tab stays current while open.
This commit is contained in:
@@ -108,6 +108,12 @@ export class ApiClient {
|
||||
get: (sku) => this.#json('GET', `/api/article/${enc(sku)}`),
|
||||
/** GET /api/article/{sku}/history → { history: [{ id, date, text }, ...] } */
|
||||
history: (sku) => this.#json('GET', `/api/article/${enc(sku)}/history`),
|
||||
/**
|
||||
* Load history and refetch on SSE `article-<sku>`.
|
||||
* `onHistory(history)` / `onError(err)` — returns unwatch().
|
||||
*/
|
||||
historyWatch: (sku, onHistory, onError) =>
|
||||
this.watchArticleHistory(sku, onHistory, onError),
|
||||
/** PATCH /api/article/{sku} — body: at least one of { name, unitamount, unitSi } */
|
||||
update: async (sku, body) => {
|
||||
const nameChange = body != null && Object.hasOwn(body, 'name');
|
||||
|
||||
Reference in New Issue
Block a user