diff --git a/src/api/supplier.js b/src/api/supplier.js index 15155b2..4a480f1 100644 --- a/src/api/supplier.js +++ b/src/api/supplier.js @@ -12,6 +12,13 @@ export const supplier = { }, // #endregion + /** GET /api/supplier/:id → { supplier: Supplier } */ + // #region GET /api/supplier/:id — get + get(id) { + return http(`/api/supplier/${encodeURIComponent(id)}`); + }, + // #endregion + /** * POST /api/supplier * Body: { name } — empty name ⇒ 400 Name required. diff --git a/src/components/manifest/BookDeliveryDialog.jsx b/src/components/manifest/BookDeliveryDialog.jsx index 51c90c9..6efc545 100644 --- a/src/components/manifest/BookDeliveryDialog.jsx +++ b/src/components/manifest/BookDeliveryDialog.jsx @@ -98,8 +98,8 @@ export default class BookDeliveryDialog extends PureComponent { loadSupplierArticlesIfNeeded() { const supplierId = this.props.delivery?.supplierId ?? this.props.delivery?.partyId; if (supplierId && Object.keys(this.state.supplierArticlesMap).length === 0) { - void supplierApi.get(supplierId).then((res) => { - const articles = res?.supplier?.articles || res?.articles || []; + void supplierApi.getArticles(supplierId).then((res) => { + const articles = res?.articles || res?.supplier?.articles || []; const map = buildSupplierArticlesMap(articles); this.setState({ supplierArticlesMap: map }); }).catch(() => {});