mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 15:50:32 +00:00
fix(bills) : catch error message.
This commit is contained in:
@@ -6,6 +6,7 @@ import { AppToaster } from 'components';
|
|||||||
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
|
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
|
||||||
import withAlertActions from 'containers/Alert/withAlertActions';
|
import withAlertActions from 'containers/Alert/withAlertActions';
|
||||||
|
|
||||||
|
import { handleDeleteErrors } from 'containers/Purchases/Bills/BillForm/utils';
|
||||||
import { useDeleteBill } from 'hooks/query';
|
import { useDeleteBill } from 'hooks/query';
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -32,13 +33,25 @@ function BillDeleteAlert({
|
|||||||
|
|
||||||
// Handle confirm delete invoice
|
// Handle confirm delete invoice
|
||||||
const handleConfirmBillDelete = () => {
|
const handleConfirmBillDelete = () => {
|
||||||
deleteBillMutate(billId).then(() => {
|
deleteBillMutate(billId)
|
||||||
|
.then(() => {
|
||||||
AppToaster.show({
|
AppToaster.show({
|
||||||
message: formatMessage({
|
message: formatMessage({
|
||||||
id: 'the_bill_has_been_deleted_successfully',
|
id: 'the_bill_has_been_deleted_successfully',
|
||||||
}),
|
}),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
.catch(
|
||||||
|
({
|
||||||
|
response: {
|
||||||
|
data: { errors },
|
||||||
|
},
|
||||||
|
}) => {
|
||||||
|
handleDeleteErrors(errors);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.finally(() => {
|
||||||
closeAlert(name);
|
closeAlert(name);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user