Add error for co category set for product
This commit is contained in:
parent
1945e9065b
commit
467319ebce
2 changed files with 12 additions and 1 deletions
|
@ -300,7 +300,12 @@ export const ProductUpdate: React.FC<ProductUpdateProps> = ({ id, params }) => {
|
|||
const [updateChannels, updateChannelsOpts] = useProductChannelListingUpdate({
|
||||
onCompleted: data => {
|
||||
if (!!data.productChannelListingUpdate.errors.length) {
|
||||
return;
|
||||
data.productChannelListingUpdate.errors.map(error =>
|
||||
notify({
|
||||
status: "error",
|
||||
text: getProductErrorMessage(error, intl)
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -50,6 +50,10 @@ const messages = defineMessages({
|
|||
variantUnique: {
|
||||
defaultMessage: "This variant already exists",
|
||||
description: "product attribute error"
|
||||
},
|
||||
noCategorySet: {
|
||||
defaultMessage: "Product category not set",
|
||||
description: "no category set error"
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -79,6 +83,8 @@ function getProductErrorMessage(
|
|||
return intl.formatMessage(messages.variantNoDigitalContent);
|
||||
case ProductErrorCode.UNSUPPORTED_MEDIA_PROVIDER:
|
||||
return intl.formatMessage(messages.unsupportedMediaProvider);
|
||||
case ProductErrorCode.PRODUCT_WITHOUT_CATEGORY:
|
||||
return intl.formatMessage(messages.noCategorySet);
|
||||
case ProductErrorCode.INVALID:
|
||||
if (err.field === "price") {
|
||||
return intl.formatMessage(messages.priceInvalid);
|
||||
|
|
Loading…
Reference in a new issue