Skip to content

Commit

Permalink
Merge pull request binary-com#132 from mahdiyeh-deriv/Mahdiyeh/85846/…
Browse files Browse the repository at this point in the history
…fix_switcher_account_loading

Mahdiyeh/ fix: reloading of account_switcher
  • Loading branch information
matin-deriv committed Jan 13, 2023
2 parents ca3d18f + 6e5c465 commit dcee1b3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/Stores/traders-hub-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,20 @@ export default class TradersHubStore extends BaseStore {
}

async setSwitchEU() {
const { account_list, switchAccount, loginid } = this.root_store.client;
const { account_list, switchAccount, loginid, setIsLoggingIn } = this.root_store.client;

const mf_account = account_list.find(acc => acc.loginid.startsWith('MF'))?.loginid;
const cr_account = account_list.find(acc => acc.loginid.startsWith('CR'))?.loginid;

if (this.selected_region === 'EU' && !loginid.startsWith('MF')) {
// if active_loginid is already EU = do nothing
await switchAccount(mf_account);
await switchAccount(mf_account).then(() => {
setIsLoggingIn(false);
});
} else if (this.selected_region === 'Non-EU' && !loginid.startsWith('CR')) {
await switchAccount(cr_account);
await switchAccount(cr_account).then(() => {
setIsLoggingIn(false);
});
}
}

Expand Down

0 comments on commit dcee1b3

Please sign in to comment.