-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
george / PRODQA-1316 / Transfer from Tradershub validation #9908
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ const AccountTransferModal = observer(({ is_modal_open, toggleModal }: TAccountT | |
modules: { | ||
cashier: { | ||
account_transfer: { is_transfer_confirm, should_switch_account, setShouldSwitchAccount }, | ||
general_store: { setActiveTab }, | ||
}, | ||
}, | ||
traders_hub: { closeModal, setSelectedAccount }, | ||
|
@@ -24,13 +25,18 @@ const AccountTransferModal = observer(({ is_modal_open, toggleModal }: TAccountT | |
const history = useHistory(); | ||
|
||
React.useEffect(() => { | ||
if (is_modal_open) setActiveTab('account_transfer'); | ||
|
||
return () => { | ||
setShouldSwitchAccount(false); | ||
setSelectedAccount({}); | ||
closeModal(); | ||
if (is_modal_open) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here we do the cleanup when the user is closing the modal |
||
setShouldSwitchAccount(false); | ||
setSelectedAccount({}); | ||
setActiveTab('deposit'); | ||
closeModal(); | ||
} | ||
}; | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
}, [is_modal_open]); | ||
|
||
const modal_title = !is_transfer_confirm && <Localize i18n_default_text={'Transfer funds to your accounts'} />; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,7 +146,7 @@ const AccountTransferForm = observer( | |
}); | ||
if (!is_ok) return message; | ||
|
||
if (selected_from.balance && Number(selected_from.balance) < Number(amount)) | ||
if (typeof selected_from.balance !== 'undefined' && Number(selected_from.balance) < Number(amount)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to check if selected.balance is not an |
||
return localize('Insufficient balance'); | ||
|
||
return undefined; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we set an active container as
'account_transfer'
when the user is clicking on Transfer button in TH and the modal is openingbecause previously we set active_container as
'deposit'
by default and apply wrong validation