From b03d95e85cc7c202950da4f00822af07166aee3a Mon Sep 17 00:00:00 2001
From: Aizad Ridzo <103104395+aizad-deriv@users.noreply.github.com>
Date: Thu, 18 Apr 2024 21:51:34 +0800
Subject: [PATCH] [WALL] Aizad/WALL-3802/Error Message doesn't appear when
Failed Reset MT5 Password Modal (#14683)
* chore: added Password Error modal for MT5 Reset Password Modal
* chore: fix type errors and use errors instead of isError
---
.../WalletsResetMT5Password.tsx | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/packages/wallets/src/components/WalletsResetMT5Password/WalletsResetMT5Password.tsx b/packages/wallets/src/components/WalletsResetMT5Password/WalletsResetMT5Password.tsx
index 86ba97668d4a..320d43d355dd 100644
--- a/packages/wallets/src/components/WalletsResetMT5Password/WalletsResetMT5Password.tsx
+++ b/packages/wallets/src/components/WalletsResetMT5Password/WalletsResetMT5Password.tsx
@@ -7,6 +7,7 @@ import { TPlatforms } from '../../types';
import { validPassword, validPasswordMT5 } from '../../utils/password-validation';
import { ModalWrapper, WalletButton, WalletPasswordFieldLazy, WalletText } from '../Base';
import { useModal } from '../ModalProvider';
+import { WalletError } from '../WalletError';
import WalletSuccessResetMT5Password from './WalletSuccessResetMT5Password';
import './WalletsResetMT5Password.scss';
@@ -32,12 +33,14 @@ const WalletsResetMT5Password = ({
}: WalletsResetMT5PasswordProps) => {
const { title } = PlatformDetails[platform];
const {
+ error: changePasswordError,
isError: isChangePasswordError,
isLoading: isChangePasswordLoading,
isSuccess: isChangePasswordSuccess,
mutate: changePassword,
} = useTradingPlatformPasswordReset();
const {
+ error: changeInvestorPasswordError,
isError: isChangeInvestorPasswordError,
isLoading: isChangeInvestorPasswordLoading,
isSuccess: isChangeInvestorPasswordSuccess,
@@ -73,7 +76,13 @@ const WalletsResetMT5Password = ({
localStorage.removeItem(`verification_code.${actionParams}`); // TODO:Remove verification code from local storage
show(, { defaultRootId: 'wallets_modal_root' });
} else if (isChangePasswordError) {
- hide();
+ show(
+
+ );
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [platform, title, actionParams, isChangePasswordSuccess, isChangePasswordError]);
@@ -85,7 +94,13 @@ const WalletsResetMT5Password = ({
defaultRootId: 'wallets_modal_root',
});
} else if (isChangeInvestorPasswordError) {
- hide();
+ show(
+
+ );
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [platform, title, actionParams, isChangeInvestorPasswordSuccess, isChangeInvestorPasswordError]);