u
This commit is contained in:
@@ -12,6 +12,13 @@ export const supplier = {
|
|||||||
},
|
},
|
||||||
// #endregion
|
// #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
|
* POST /api/supplier
|
||||||
* Body: { name } — empty name ⇒ 400 Name required.
|
* Body: { name } — empty name ⇒ 400 Name required.
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ export default class BookDeliveryDialog extends PureComponent {
|
|||||||
loadSupplierArticlesIfNeeded() {
|
loadSupplierArticlesIfNeeded() {
|
||||||
const supplierId = this.props.delivery?.supplierId ?? this.props.delivery?.partyId;
|
const supplierId = this.props.delivery?.supplierId ?? this.props.delivery?.partyId;
|
||||||
if (supplierId && Object.keys(this.state.supplierArticlesMap).length === 0) {
|
if (supplierId && Object.keys(this.state.supplierArticlesMap).length === 0) {
|
||||||
void supplierApi.get(supplierId).then((res) => {
|
void supplierApi.getArticles(supplierId).then((res) => {
|
||||||
const articles = res?.supplier?.articles || res?.articles || [];
|
const articles = res?.articles || res?.supplier?.articles || [];
|
||||||
const map = buildSupplierArticlesMap(articles);
|
const map = buildSupplierArticlesMap(articles);
|
||||||
this.setState({ supplierArticlesMap: map });
|
this.setState({ supplierArticlesMap: map });
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|||||||
Reference in New Issue
Block a user