From 823bbd94b79ee9b8e30e51794bcfe61fb4c4d695 Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Sun, 12 Sep 2021 15:47:46 +0200 Subject: [PATCH] BIG-31: fix close drawer when delete sale estimate. --- .../containers/Alerts/Estimates/EstimateDeleteAlert.js | 9 +++++++-- .../EstimateDetailDrawer/EstimateDetailActionsBar.js | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/src/containers/Alerts/Estimates/EstimateDeleteAlert.js b/client/src/containers/Alerts/Estimates/EstimateDeleteAlert.js index 383d320b3..bf11b380a 100644 --- a/client/src/containers/Alerts/Estimates/EstimateDeleteAlert.js +++ b/client/src/containers/Alerts/Estimates/EstimateDeleteAlert.js @@ -1,6 +1,6 @@ import React, { useCallback } 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 { useDeleteEstimate } from 'hooks/query'; @@ -9,6 +9,7 @@ import { AppToaster } from 'components'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertActions from 'containers/Alert/withAlertActions'; +import withDrawerActions from 'containers/Drawer/withDrawerActions'; import { compose } from 'utils'; @@ -24,8 +25,10 @@ function EstimateDeleteAlert({ // #withAlertActions closeAlert, + + // #withDrawerActions + closeDrawer, }) { - const { mutateAsync: deleteEstimateMutate, isLoading } = useDeleteEstimate(); // handle cancel delete alert. @@ -41,6 +44,7 @@ function EstimateDeleteAlert({ message: intl.get('the_estimate_has_been_deleted_successfully'), intent: Intent.SUCCESS, }); + closeDrawer('estimate-detail-drawer'); }) .catch(({ errors }) => {}) .finally(() => { @@ -71,4 +75,5 @@ function EstimateDeleteAlert({ export default compose( withAlertStoreConnect(), withAlertActions, + withDrawerActions, )(EstimateDeleteAlert); diff --git a/client/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.js b/client/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.js index b732d1183..0c468be41 100644 --- a/client/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.js +++ b/client/src/containers/Drawers/EstimateDetailDrawer/EstimateDetailActionsBar.js @@ -45,7 +45,6 @@ function EstimateDetailActionsBar({ // Handle delete sale estimate. const handleDeleteEstimate = () => { openAlert('estimate-delete', { estimateId }); - closeDrawer('estimate-detail-drawer'); }; // Handle print estimate.