mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
BIG-28: fix close drawer when delete item.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React 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 { AppToaster } from 'components';
|
import { AppToaster } from 'components';
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@ import { useDeleteItem } from 'hooks/query';
|
|||||||
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 withItemsActions from 'containers/Items/withItemsActions';
|
import withItemsActions from 'containers/Items/withItemsActions';
|
||||||
|
import withDrawerActions from 'containers/Drawer/withDrawerActions';
|
||||||
|
|
||||||
import { compose } from 'utils';
|
import { compose } from 'utils';
|
||||||
|
|
||||||
@@ -28,10 +29,12 @@ function ItemDeleteAlert({
|
|||||||
|
|
||||||
// #withItemsActions
|
// #withItemsActions
|
||||||
setItemsTableState,
|
setItemsTableState,
|
||||||
|
|
||||||
|
// #withDrawerActions
|
||||||
|
closeDrawer,
|
||||||
}) {
|
}) {
|
||||||
const { mutateAsync: deleteItem, isLoading } = useDeleteItem();
|
const { mutateAsync: deleteItem, isLoading } = useDeleteItem();
|
||||||
|
|
||||||
|
|
||||||
// Handle cancel delete item alert.
|
// Handle cancel delete item alert.
|
||||||
const handleCancelItemDelete = () => {
|
const handleCancelItemDelete = () => {
|
||||||
closeAlert(name);
|
closeAlert(name);
|
||||||
@@ -47,6 +50,7 @@ function ItemDeleteAlert({
|
|||||||
});
|
});
|
||||||
// Reset to page number one.
|
// Reset to page number one.
|
||||||
setItemsTableState({ page: 1 });
|
setItemsTableState({ page: 1 });
|
||||||
|
closeDrawer('item-detail-drawer');
|
||||||
})
|
})
|
||||||
.catch(
|
.catch(
|
||||||
({
|
({
|
||||||
@@ -86,4 +90,5 @@ export default compose(
|
|||||||
withAlertStoreConnect(),
|
withAlertStoreConnect(),
|
||||||
withAlertActions,
|
withAlertActions,
|
||||||
withItemsActions,
|
withItemsActions,
|
||||||
|
withDrawerActions,
|
||||||
)(ItemDeleteAlert);
|
)(ItemDeleteAlert);
|
||||||
|
|||||||
Reference in New Issue
Block a user