From 65ad9b916ba1c36d72bc6a11c335eeeb36f5033e Mon Sep 17 00:00:00 2001
From: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com>
Date: Fri, 6 Sep 2024 16:22:46 +0800
Subject: [PATCH] chore: redirect all errors to cashier instead of handling
them in appstore (#16600)
---
.../account-transfer-modal.tsx | 36 ++++---------------
1 file changed, 6 insertions(+), 30 deletions(-)
diff --git a/packages/appstore/src/components/account-transfer-modal/account-transfer-modal.tsx b/packages/appstore/src/components/account-transfer-modal/account-transfer-modal.tsx
index 1be8581829cd..e805fe349c08 100644
--- a/packages/appstore/src/components/account-transfer-modal/account-transfer-modal.tsx
+++ b/packages/appstore/src/components/account-transfer-modal/account-transfer-modal.tsx
@@ -1,10 +1,11 @@
import React from 'react';
-import { Link, useHistory } from 'react-router-dom';
-import { Modal, Dialog } from '@deriv/components';
+import { useHistory } from 'react-router-dom';
+import { Modal } from '@deriv/components';
import { routes } from '@deriv/shared';
import { useStore, observer } from '@deriv/stores';
-import { Localize, localize } from '@deriv/translations';
+import { Localize } from '@deriv/translations';
import AccountTransfer from '@deriv/cashier/src/pages/account-transfer';
+import ErrorDialog from '@deriv/cashier/src/components/error-dialog';
import './account-transfer-modal.scss';
type TAccountTransferModal = {
@@ -22,13 +23,11 @@ const AccountTransferModal = observer(({ is_modal_open, toggleModal }: TAccountT
},
traders_hub: { closeModal, setSelectedAccount },
} = useStore();
- const [is_error_dialog_open, setIsErrorDialogOpen] = React.useState(false);
const history = useHistory();
React.useEffect(() => {
if (is_modal_open) setActiveTab('account_transfer');
- if (error.code === 'FinancialAssessmentRequired') setIsErrorDialogOpen(true);
return () => {
if (is_modal_open) {
@@ -37,7 +36,6 @@ const AccountTransferModal = observer(({ is_modal_open, toggleModal }: TAccountT
setActiveTab('deposit');
closeModal();
}
- if (error.code === 'FinancialAssessmentRequired') setIsErrorDialogOpen(false);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [is_modal_open, error.code]);
@@ -54,30 +52,8 @@ const AccountTransferModal = observer(({ is_modal_open, toggleModal }: TAccountT
history.push(routes.cashier_acc_transfer);
};
- const dismissError = () => {
- toggleModal();
- setIsErrorDialogOpen(false);
- error.setErrorMessage({ code: '', message: '' }, null, false);
- };
-
- if (is_error_dialog_open) {
- return (
-
- );
+ if (error.code?.length) {
+ return ;
}
return (