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 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);

View File

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