BIG-31: fix close drawer when delete sale estimate.

This commit is contained in:
elforjani3
2021-09-12 15:47:46 +02:00
parent 8e262c79f5
commit 823bbd94b7
2 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
import React, { useCallback } from 'react'; import React, { useCallback } from 'react';
import intl from 'react-intl-universal'; 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 { Intent, Alert } from '@blueprintjs/core';
import { useDeleteEstimate } from 'hooks/query'; import { useDeleteEstimate } from 'hooks/query';
@@ -9,6 +9,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 withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -24,8 +25,10 @@ function EstimateDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
// #withDrawerActions
closeDrawer,
}) { }) {
const { mutateAsync: deleteEstimateMutate, isLoading } = useDeleteEstimate(); const { mutateAsync: deleteEstimateMutate, isLoading } = useDeleteEstimate();
// handle cancel delete alert. // handle cancel delete alert.
@@ -41,6 +44,7 @@ function EstimateDeleteAlert({
message: intl.get('the_estimate_has_been_deleted_successfully'), message: intl.get('the_estimate_has_been_deleted_successfully'),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeDrawer('estimate-detail-drawer');
}) })
.catch(({ errors }) => {}) .catch(({ errors }) => {})
.finally(() => { .finally(() => {
@@ -71,4 +75,5 @@ function EstimateDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions,
)(EstimateDeleteAlert); )(EstimateDeleteAlert);

View File

@@ -45,7 +45,6 @@ function EstimateDetailActionsBar({
// Handle delete sale estimate. // Handle delete sale estimate.
const handleDeleteEstimate = () => { const handleDeleteEstimate = () => {
openAlert('estimate-delete', { estimateId }); openAlert('estimate-delete', { estimateId });
closeDrawer('estimate-detail-drawer');
}; };
// Handle print estimate. // Handle print estimate.