This commit is contained in:
seb
2026-10-18 00:38:45 +02:00
parent 691854fdd4
commit 0a59a0987a
2 changed files with 9 additions and 2 deletions

View File

@@ -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.

View File

@@ -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(() => {});