mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
fix: transform message error with customers.
This commit is contained in:
@@ -146,6 +146,20 @@ function CustomersList({
|
|||||||
setBulkDelete(false);
|
setBulkDelete(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const transformApiErrors = (errors) => {
|
||||||
|
if (
|
||||||
|
errors.find(
|
||||||
|
(error) => error.type === 'SOME.CUSTOMERS.HAVE.SALES_INVOICES',
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
AppToaster.show({
|
||||||
|
message: formatMessage({
|
||||||
|
id: 'some_customers_have_sales_invoices',
|
||||||
|
}),
|
||||||
|
intent: Intent.DANGER,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
// Handle confirm customers bulk delete.
|
// Handle confirm customers bulk delete.
|
||||||
const handleConfirmBulkDelete = useCallback(() => {
|
const handleConfirmBulkDelete = useCallback(() => {
|
||||||
requestDeleteBulkCustomers(bulkDelete)
|
requestDeleteBulkCustomers(bulkDelete)
|
||||||
@@ -158,7 +172,8 @@ function CustomersList({
|
|||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((errors) => {
|
||||||
|
transformApiErrors(errors);
|
||||||
setBulkDelete(false);
|
setBulkDelete(false);
|
||||||
});
|
});
|
||||||
}, [requestDeleteBulkCustomers, bulkDelete, formatMessage]);
|
}, [requestDeleteBulkCustomers, bulkDelete, formatMessage]);
|
||||||
|
|||||||
@@ -938,5 +938,6 @@ export default {
|
|||||||
no_results: 'No results.',
|
no_results: 'No results.',
|
||||||
the_invoice_cannot_be_deleted:
|
the_invoice_cannot_be_deleted:
|
||||||
'The invoice cannot be deleted cause has associated payment transactions',
|
'The invoice cannot be deleted cause has associated payment transactions',
|
||||||
category_name_exists:'Category name exists'
|
category_name_exists: 'Category name exists',
|
||||||
};
|
some_customers_have_sales_invoices: 'Some customers have sales invoices',
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user