refactor: customers alerts.

This commit is contained in:
elforjani3
2021-01-27 20:01:33 +02:00
parent 29259f460d
commit 25d4b558b6
13 changed files with 311 additions and 213 deletions

View File

@@ -0,0 +1,25 @@
import React from 'react';
import { Intent } from '@blueprintjs/core';
import { AppToaster } from 'components';
import { formatMessage } from 'services/intl';
export const transformErrors = (errors) => {
if (errors.some((e) => e.type === 'CUSTOMER.HAS.SALES_INVOICES')) {
AppToaster.show({
message: formatMessage({
id: 'customer_has_sales_invoices',
}),
intent: Intent.DANGER,
});
}
if (
errors.find((error) => error.type === 'SOME.CUSTOMERS.HAVE.SALES_INVOICES')
) {
AppToaster.show({
message: formatMessage({
id: 'some_customers_have_sales_invoices',
}),
intent: Intent.DANGER,
});
}
};