BIG-28: fix close drawer when delete item.

This commit is contained in:
elforjani3
2021-09-12 15:45:56 +02:00
parent 0b6b7989ac
commit 7ce15cda3c

View File

@@ -10,6 +10,7 @@ import { useDeleteItem } from 'hooks/query';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withAlertActions from 'containers/Alert/withAlertActions';
import withItemsActions from 'containers/Items/withItemsActions';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils';
@@ -28,10 +29,12 @@ function ItemDeleteAlert({
// #withItemsActions
setItemsTableState,
// #withDrawerActions
closeDrawer,
}) {
const { mutateAsync: deleteItem, isLoading } = useDeleteItem();
// Handle cancel delete item alert.
const handleCancelItemDelete = () => {
closeAlert(name);
@@ -47,6 +50,7 @@ function ItemDeleteAlert({
});
// Reset to page number one.
setItemsTableState({ page: 1 });
closeDrawer('item-detail-drawer');
})
.catch(
({
@@ -86,4 +90,5 @@ export default compose(
withAlertStoreConnect(),
withAlertActions,
withItemsActions,
withDrawerActions,
)(ItemDeleteAlert);