Skip to content

Commit

Permalink
[WALL] Aizad/WALL-3802/Error Message doesn't appear when Failed Reset…
Browse files Browse the repository at this point in the history
… MT5 Password Modal (deriv-com#14683)

* chore: added Password Error modal for MT5 Reset Password Modal

* chore: fix type errors and use errors instead of isError
  • Loading branch information
aizad-deriv authored Apr 18, 2024
1 parent a4a8536 commit b03d95e
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
Expand Down Expand Up @@ -73,7 +76,13 @@ const WalletsResetMT5Password = ({
localStorage.removeItem(`verification_code.${actionParams}`); // TODO:Remove verification code from local storage
show(<WalletSuccessResetMT5Password title={title} />, { defaultRootId: 'wallets_modal_root' });
} else if (isChangePasswordError) {
hide();
show(
<WalletError
errorMessage={changePasswordError?.error?.message}
onClick={hide}
title={changePasswordError?.error?.code}
/>
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [platform, title, actionParams, isChangePasswordSuccess, isChangePasswordError]);
Expand All @@ -85,7 +94,13 @@ const WalletsResetMT5Password = ({
defaultRootId: 'wallets_modal_root',
});
} else if (isChangeInvestorPasswordError) {
hide();
show(
<WalletError
errorMessage={changeInvestorPasswordError?.error?.message}
onClick={hide}
title={changeInvestorPasswordError?.error?.code}
/>
);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [platform, title, actionParams, isChangeInvestorPasswordSuccess, isChangeInvestorPasswordError]);
Expand Down

0 comments on commit b03d95e

Please sign in to comment.