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