Skip to content

Commit

Permalink
fix: Add a Deriv Account pop up is broken if user select same duplica… (
Browse files Browse the repository at this point in the history
#11216)

* fix: Add a Deriv Account pop up is broken if user select same duplicated currency

* chore: add operation check for local props

* chore: fix flickering issue

---------

Co-authored-by: amina-deriv <amina@regentmarkets.com>
  • Loading branch information
suisin-deriv and amina-deriv committed May 13, 2024
1 parent b5de24e commit d539a1e
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,18 @@ const RealAccountSignup = observer(({ history, state_index, is_trading_experienc
onConfirm={() => onErrorConfirm(local_props.state_value.error_code)}
/>
),
title: () => localize('Add a real account'),
title: local_props => {
if (local_props?.real_account_signup_target === 'add_crypto') {
return localize('Create a cryptocurrency account');
} else if (local_props?.real_account_signup_target === 'add_fiat') {
return localize('Add a Deriv real account');
} else if (local_props?.real_account_signup_target === 'add_currency') {
return localize('Create a new account');
} else if (local_props?.has_fiat && local_props?.available_crypto_currencies?.length === 0) {
return localize('Manage account');
}
return localize('Add or manage account');
},
},
{
body: () => <ChooseCurrency className='account-wizard__body' onError={showErrorModal} />,
Expand Down Expand Up @@ -435,9 +446,11 @@ const RealAccountSignup = observer(({ history, state_index, is_trading_experienc
};

const onErrorConfirm = err_code => {
const addOrManageAccountErrorType = ['CurrencyTypeNotAllowed', 'DuplicateCurrency'];
setLoading(true);
setParams({
active_modal_index:
current_action === 'multi' || err_code === 'CurrencyTypeNotAllowed'
current_action === 'multi' || addOrManageAccountErrorType.includes(err_code)
? modal_pages_indices.add_or_manage_account
: modal_pages_indices.account_wizard,
});
Expand Down

0 comments on commit d539a1e

Please sign in to comment.