fix(vendor): catch error message.

This commit is contained in:
elforjani3
2021-03-21 18:20:48 +02:00
parent ad50da4214
commit 27670d51ed
3 changed files with 27 additions and 8 deletions

View File

@@ -0,0 +1,15 @@
import React from 'react';
import { Intent } from '@blueprintjs/core';
import { AppToaster } from 'components';
import { formatMessage } from 'services/intl';
export const transformErrors = (errors) => {
if (errors.find((error) => error.type === 'VENDOR.HAS.ASSOCIATED.BILLS')) {
AppToaster.show({
message: formatMessage({
id: 'cannot_delete_vendor_that_has_associated_purchase_bills',
}),
intent: Intent.DANGER,
});
}
};