mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
refactor: customers alerts.
This commit is contained in:
25
client/src/containers/Customers/utils.js
Normal file
25
client/src/containers/Customers/utils.js
Normal 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,
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user