mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
fix(item): handle errors.
This commit is contained in:
@@ -30,7 +30,7 @@ function ItemDeleteAlert({
|
|||||||
closeAlert,
|
closeAlert,
|
||||||
|
|
||||||
// #withItemsActions
|
// #withItemsActions
|
||||||
addItemsTableQueries
|
addItemsTableQueries,
|
||||||
}) {
|
}) {
|
||||||
const { mutateAsync: deleteItem, isLoading } = useDeleteItem();
|
const { mutateAsync: deleteItem, isLoading } = useDeleteItem();
|
||||||
const { formatMessage } = useIntl();
|
const { formatMessage } = useIntl();
|
||||||
@@ -53,9 +53,15 @@ function ItemDeleteAlert({
|
|||||||
// Reset to page number one.
|
// Reset to page number one.
|
||||||
addItemsTableQueries({ page: 1 });
|
addItemsTableQueries({ page: 1 });
|
||||||
})
|
})
|
||||||
.catch(({ errors }) => {
|
.catch(
|
||||||
handleDeleteErrors(errors);
|
({
|
||||||
})
|
response: {
|
||||||
|
data: { errors },
|
||||||
|
},
|
||||||
|
}) => {
|
||||||
|
handleDeleteErrors(errors);
|
||||||
|
},
|
||||||
|
)
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
closeAlert(name);
|
closeAlert(name);
|
||||||
});
|
});
|
||||||
@@ -84,5 +90,5 @@ function ItemDeleteAlert({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withAlertStoreConnect(),
|
withAlertStoreConnect(),
|
||||||
withAlertActions,
|
withAlertActions,
|
||||||
withItemsActions
|
withItemsActions,
|
||||||
)(ItemDeleteAlert);
|
)(ItemDeleteAlert);
|
||||||
|
|||||||
Reference in New Issue
Block a user