mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
BIG-35: fix close drawer when delete expense.
This commit is contained in:
@@ -6,6 +6,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 { useDeleteExpense } from 'hooks/query';
|
import { useDeleteExpense } from 'hooks/query';
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
@@ -20,6 +21,9 @@ function ExpenseDeleteAlert({
|
|||||||
// #withAlertStoreConnect
|
// #withAlertStoreConnect
|
||||||
isOpen,
|
isOpen,
|
||||||
payload: { expenseId },
|
payload: { expenseId },
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
closeDrawer,
|
||||||
}) {
|
}) {
|
||||||
const { mutateAsync: deleteExpenseMutate, isLoading } = useDeleteExpense();
|
const { mutateAsync: deleteExpenseMutate, isLoading } = useDeleteExpense();
|
||||||
|
|
||||||
@@ -38,7 +42,7 @@ function ExpenseDeleteAlert({
|
|||||||
}),
|
}),
|
||||||
intent: Intent.SUCCESS,
|
intent: Intent.SUCCESS,
|
||||||
});
|
});
|
||||||
closeAlert('expense-delete');
|
closeDrawer('expense-drawer');
|
||||||
})
|
})
|
||||||
.catch(
|
.catch(
|
||||||
({
|
({
|
||||||
@@ -57,7 +61,10 @@ function ExpenseDeleteAlert({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
)
|
||||||
|
.finally(() => {
|
||||||
|
closeAlert('expense-delete');
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -81,4 +88,5 @@ function ExpenseDeleteAlert({
|
|||||||
export default compose(
|
export default compose(
|
||||||
withAlertStoreConnect(),
|
withAlertStoreConnect(),
|
||||||
withAlertActions,
|
withAlertActions,
|
||||||
|
withDrawerActions,
|
||||||
)(ExpenseDeleteAlert);
|
)(ExpenseDeleteAlert);
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ function ExpenseDrawerActionBar({
|
|||||||
// Handle the expense delete action.
|
// Handle the expense delete action.
|
||||||
const handleDeleteExpense = () => {
|
const handleDeleteExpense = () => {
|
||||||
openAlert('expense-delete', { expenseId: expense.id });
|
openAlert('expense-delete', { expenseId: expense.id });
|
||||||
closeDrawer('expense-drawer');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user