From 0963394b048f81d992e8c22e777c303cac4b2a83 Mon Sep 17 00:00:00 2001 From: Ahmed Bouhuolia Date: Wed, 4 Feb 2026 21:27:25 +0200 Subject: [PATCH] fix(webapp): account delete error handling response types --- packages/webapp/src/containers/Accounts/utils.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/webapp/src/containers/Accounts/utils.tsx b/packages/webapp/src/containers/Accounts/utils.tsx index 7ed74ceb6..384ebab3f 100644 --- a/packages/webapp/src/containers/Accounts/utils.tsx +++ b/packages/webapp/src/containers/Accounts/utils.tsx @@ -8,6 +8,11 @@ import { If, AppToaster } from '@/components'; import { NormalCell, BalanceCell, BankBalanceCell } from './components'; import { transformTableStateToQuery, isBlank } from '@/utils'; +export const DeleteAccountTypeError = { + AccountPredefined: 'account_predefined', + AccountHasAssociatedTransactions: 'account_has_associated_transactions', +}; + /** * Account name accessor. */ @@ -26,13 +31,13 @@ export const accountNameAccessor = (account) => { * Handle delete errors in bulk and singular. */ export const handleDeleteErrors = (errors) => { - if (errors.find((e) => e.type === 'ACCOUNT.PREDEFINED')) { + if (errors.find((e) => e.type === DeleteAccountTypeError.AccountPredefined)) { AppToaster.show({ message: intl.get('cannot_delete_predefined_accounts'), intent: Intent.DANGER, }); } - if (errors.find((e) => e.type === 'ACCOUNT.HAS.ASSOCIATED.TRANSACTIONS')) { + if (errors.find((e) => e.type === DeleteAccountTypeError.AccountHasAssociatedTransactions)) { AppToaster.show({ message: intl.get('cannot_delete_account_has_associated_transactions'), intent: Intent.DANGER,