diff --git a/client/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.js b/client/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.js index 9959a2dfd..892330ecf 100644 --- a/client/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.js +++ b/client/src/containers/Alerts/Items/InventoryAdjustmentDeleteAlert.js @@ -1,14 +1,13 @@ import React from 'react'; import intl from 'react-intl-universal'; -import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; +import { FormattedMessage as T, FormattedHTMLMessage } from 'components'; import { Intent, Alert } from '@blueprintjs/core'; import { AppToaster } from 'components'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; -import { - useDeleteInventoryAdjustment -} from 'hooks/query'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; +import { useDeleteInventoryAdjustment } from 'hooks/query'; import { compose } from 'utils'; @@ -24,12 +23,12 @@ function InventoryAdjustmentDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - - const { - mutateAsync: deleteInventoryAdjMutate, - isLoading - } = useDeleteInventoryAdjustment(); + const { mutateAsync: deleteInventoryAdjMutate, isLoading } = + useDeleteInventoryAdjustment(); // handle cancel delete alert. const handleCancelInventoryAdjustmentDelete = () => { @@ -44,6 +43,7 @@ function InventoryAdjustmentDeleteAlert({ message: intl.get('the_adjustment_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('inventory-adjustment-drawer'); }) .catch((errors) => {}) .finally(() => { @@ -76,4 +76,5 @@ function InventoryAdjustmentDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(InventoryAdjustmentDeleteAlert); diff --git a/client/src/containers/Drawers/InventoryAdjustmentDetailDrawer/InventoryAdjustmentDetailActionsBar.js b/client/src/containers/Drawers/InventoryAdjustmentDetailDrawer/InventoryAdjustmentDetailActionsBar.js index e97eee29c..e0231a3e9 100644 --- a/client/src/containers/Drawers/InventoryAdjustmentDetailDrawer/InventoryAdjustmentDetailActionsBar.js +++ b/client/src/containers/Drawers/InventoryAdjustmentDetailDrawer/InventoryAdjustmentDetailActionsBar.js @@ -6,7 +6,6 @@ import DashboardActionsBar from 'components/Dashboard/DashboardActionsBar'; import { useInventoryAdjustmentDrawerContext } from './InventoryAdjustmentDrawerProvider'; import withAlertsActions from 'containers/Alert/withAlertActions'; -import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { Icon, FormattedMessage as T } from 'components'; @@ -18,16 +17,12 @@ import { compose } from 'utils'; function InventoryAdjustmentDetailActionsBar({ // #withAlertsActions openAlert, - - // #withDrawerActions - closeDrawer, }) { const { inventoryId } = useInventoryAdjustmentDrawerContext(); // Handle delete inventory adjustment. const handleDeleteInventoryAdjustment = () => { openAlert('inventory-adjustment-delete', { inventoryId }); - closeDrawer('inventory-adjustment-drawer'); }; return ( @@ -45,7 +40,4 @@ function InventoryAdjustmentDetailActionsBar({ ); } -export default compose( - withDrawerActions, - withAlertsActions, -)(InventoryAdjustmentDetailActionsBar); +export default compose(withAlertsActions)(InventoryAdjustmentDetailActionsBar);