BIG-36: fix close drawer when delete Manual journals.

This commit is contained in:
elforjani3
2021-09-12 17:16:47 +02:00
parent 4711ab34d4
commit d15c32cc8c

View File

@@ -8,6 +8,7 @@ import { AppToaster } from 'components';
import withAlertActions from 'containers/Alert/withAlertActions'; import withAlertActions from 'containers/Alert/withAlertActions';
import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect'; import withAlertStoreConnect from 'containers/Alert/withAlertStoreConnect';
import withDrawerActions from 'containers/Drawer/withDrawerActions';
import { compose } from 'utils'; import { compose } from 'utils';
@@ -23,8 +24,10 @@ function JournalDeleteAlert({
// #withAlertActions // #withAlertActions
closeAlert, closeAlert,
// #withDrawerActions
closeDrawer,
}) { }) {
const { mutateAsync: deleteJournalMutate, isLoading } = useDeleteJournal(); const { mutateAsync: deleteJournalMutate, isLoading } = useDeleteJournal();
// Handle cancel delete manual journal. // Handle cancel delete manual journal.
@@ -37,13 +40,13 @@ function JournalDeleteAlert({
deleteJournalMutate(manualJournalId) deleteJournalMutate(manualJournalId)
.then(() => { .then(() => {
AppToaster.show({ AppToaster.show({
message: intl.get( message: intl.get('the_journal_has_been_deleted_successfully', {
'the_journal_has_been_deleted_successfully', number: journalNumber,
{ number: journalNumber }, }),
),
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
closeAlert(name); closeAlert(name);
closeDrawer('journal-drawer');
}) })
.catch(() => { .catch(() => {
closeAlert(name); closeAlert(name);
@@ -71,4 +74,5 @@ function JournalDeleteAlert({
export default compose( export default compose(
withAlertStoreConnect(), withAlertStoreConnect(),
withAlertActions, withAlertActions,
withDrawerActions
)(JournalDeleteAlert); )(JournalDeleteAlert);