diff --git a/packages/webapp/src/components/DialogsContainer.tsx b/packages/webapp/src/components/DialogsContainer.tsx
index 5c753c213..284c3cfbc 100644
--- a/packages/webapp/src/components/DialogsContainer.tsx
+++ b/packages/webapp/src/components/DialogsContainer.tsx
@@ -52,6 +52,7 @@ import ReceiptMailDialog from '@/containers/Sales/Receipts/ReceiptMailDialog/Rec
import PaymentMailDialog from '@/containers/Sales/PaymentReceives/PaymentMailDialog/PaymentMailDialog';
import { ExportDialog } from '@/containers/Dialogs/ExportDialog';
import { RuleFormDialog } from '@/containers/Banking/Rules/RuleFormDialog/RuleFormDialog';
+import { DisconnectBankAccountDialog } from '@/containers/CashFlow/AccountTransactions/dialogs/DisconnectBankAccountDialog/DisconnectBankAccountDialog';
/**
* Dialogs container.
@@ -148,7 +149,10 @@ export default function DialogsContainer() {
-
+
+
);
}
diff --git a/packages/webapp/src/constants/dialogs.ts b/packages/webapp/src/constants/dialogs.ts
index 07ed83d67..b86755cfb 100644
--- a/packages/webapp/src/constants/dialogs.ts
+++ b/packages/webapp/src/constants/dialogs.ts
@@ -75,5 +75,6 @@ export enum DialogsName {
GeneralLedgerPdfPreview = 'GeneralLedgerPdfPreview',
SalesTaxLiabilitySummaryPdfPreview = 'SalesTaxLiabilitySummaryPdfPreview',
Export = 'Export',
- BankRuleForm = 'BankRuleForm'
+ BankRuleForm = 'BankRuleForm',
+ DisconnectBankAccountConfirmation = 'DisconnectBankAccountConfirmation',
}
diff --git a/packages/webapp/src/containers/CashFlow/AccountTransactions/AccountTransactionsActionsBar.tsx b/packages/webapp/src/containers/CashFlow/AccountTransactions/AccountTransactionsActionsBar.tsx
index bbbc8a187..7a5ddd8fc 100644
--- a/packages/webapp/src/containers/CashFlow/AccountTransactions/AccountTransactionsActionsBar.tsx
+++ b/packages/webapp/src/containers/CashFlow/AccountTransactions/AccountTransactionsActionsBar.tsx
@@ -40,13 +40,13 @@ import withSettingsActions from '@/containers/Settings/withSettingsActions';
import { compose } from '@/utils';
import {
- useDisconnectBankAccount,
useUpdateBankAccount,
useExcludeUncategorizedTransactions,
useUnexcludeUncategorizedTransactions,
} from '@/hooks/query/bank-rules';
import { withBanking } from '../withBanking';
import withAlertActions from '@/containers/Alert/withAlertActions';
+import { DialogsName } from '@/constants/dialogs';
function AccountTransactionsActionsBar({
// #withDialogActions
@@ -71,7 +71,6 @@ function AccountTransactionsActionsBar({
// Refresh cashflow infinity transactions hook.
const { refresh } = useRefreshCashflowTransactionsInfinity();
- const { mutateAsync: disconnectBankAccount } = useDisconnectBankAccount();
const { mutateAsync: updateBankAccount } = useUpdateBankAccount();
// Retrieves the money in/out buttons options.
@@ -112,19 +111,9 @@ function AccountTransactionsActionsBar({
// Handles the bank account disconnect click.
const handleDisconnectClick = () => {
- disconnectBankAccount({ bankAccountId: accountId })
- .then(() => {
- AppToaster.show({
- message: 'The bank account has been disconnected.',
- intent: Intent.SUCCESS,
- });
- })
- .catch((error) => {
- AppToaster.show({
- message: 'Something went wrong.',
- intent: Intent.DANGER,
- });
- });
+ openDialog(DialogsName.DisconnectBankAccountConfirmation, {
+ bankAccountId: accountId,
+ });
};
// handles the bank update button click.
const handleBankUpdateClick = () => {
@@ -301,7 +290,7 @@ function AccountTransactionsActionsBar({
}}
content={