u
This commit is contained in:
@@ -82,15 +82,27 @@ export default class ArticleLabelTab extends PureComponent {
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (
|
||||
prevProps.article?.sku !== this.props.article?.sku ||
|
||||
prevProps.article?.name !== this.props.article?.name ||
|
||||
prevProps.article?.prices !== this.props.article?.prices ||
|
||||
prevProps.article?.eans !== this.props.article?.eans
|
||||
) {
|
||||
this.loadData();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.unsub?.();
|
||||
}
|
||||
|
||||
async loadData() {
|
||||
this.setState({ loading: true, error: null });
|
||||
const sku = this.props.article?.sku;
|
||||
try {
|
||||
const [resTemplates] = await Promise.all([
|
||||
labeltemplate.list(),
|
||||
labeltemplate.list(sku ? { sku } : undefined),
|
||||
companyAutomat.actions.loadAgentPrinters().catch(() => companyAutomat.state.agentprinters),
|
||||
]);
|
||||
|
||||
@@ -139,6 +151,7 @@ export default class ArticleLabelTab extends PureComponent {
|
||||
try {
|
||||
await article.printLabel(articleData.sku, {
|
||||
templateId: selectedTemplateId,
|
||||
agentprinterId: selectedPrinterId,
|
||||
printerId: selectedPrinterId,
|
||||
quantity,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user