Skip to content

Commit

Permalink
refactor(account transfer): refactor condition into function
Browse files Browse the repository at this point in the history
  • Loading branch information
heorhi-deriv committed Aug 23, 2022
1 parent 64a7ee6 commit 8062040
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ const AccountTransferForm = ({
return undefined;
};

const shouldShowTransferButton = amount => {
return selected_from.currency === selected_to.currency ? !amount : !converter_from_amount;
};

const getAccounts = (type, { is_mt, is_dxtrade }) => {
if (type === 'from') {
if (is_mt) return mt_accounts_from;
Expand Down Expand Up @@ -601,9 +605,7 @@ const AccountTransferForm = ({
!+selected_from.balance ||
!!converter_from_error ||
!!converter_to_error ||
(selected_from.currency === selected_to.currency
? !values.amount
: !converter_from_amount)
shouldShowTransferButton(values.amount)
}
primary
large
Expand Down

0 comments on commit 8062040

Please sign in to comment.