Skip to content

Commit

Permalink
Fix code to get the selected Account
Browse files Browse the repository at this point in the history
  • Loading branch information
parasharrajat committed Jan 21, 2022
1 parent 41feaa9 commit 0043cec
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pages/settings/Payments/TransferBalancePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,13 @@ class TransferBalancePage extends React.Component {
this.props.userWallet,
);

return _.find(paymentMethods, method => (method.accountType === this.props.walletTransfer.selectedAccountType
&& method.methodID === this.props.walletTransfer.selectedAccountID)
|| method.isDefault);
const defaultAccount = _.find(paymentMethods, method => method.isDefault);
const selectedAccount = _.find(
paymentMethods,
method => method.accountType === this.props.walletTransfer.selectedAccountType
&& method.methodID === this.props.walletTransfer.selectedAccountID,
);
return selectedAccount || defaultAccount;
}

/**
Expand Down

0 comments on commit 0043cec

Please sign in to comment.