Skip to content

Commit

Permalink
Merge pull request #241 from farabi-deriv/farabi/fix-wallet-account-s…
Browse files Browse the repository at this point in the history
…witcher-query-param

Farabi/fix-wallet-account-switcher-query-param
  • Loading branch information
shafin-deriv authored Jan 21, 2025
2 parents 9a3ca30 + 297f708 commit a72d049
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ export const AccountSwitcherWalletItem = observer(
localStorage.setItem('active_loginid', loginId.toString());
await api_base?.init(true);
closeAccountsDialog();

const client_accounts = JSON.parse(localStorage.getItem('clientAccounts') ?? '{}');
const search_params = new URLSearchParams(window.location.search);
const selected_account = Object.values(client_accounts)?.find(
(acc: any) => acc.loginid === loginId.toString()

Check warning on line 54 in src/components/layout/header/AccountSwitcherWallet/account-switcher-wallet-item.tsx

View workflow job for this annotation

GitHub Actions / build_to_cloudflare_pages

Unexpected any. Specify a different type

Check warning on line 54 in src/components/layout/header/AccountSwitcherWallet/account-switcher-wallet-item.tsx

View workflow job for this annotation

GitHub Actions / build_to_cloudflare_pages

Unexpected any. Specify a different type
);
if (!selected_account) return;
const account_param = is_virtual ? 'demo' : selected_account.currency;
search_params.set('account', account_param);
window.history.pushState({}, '', `${window.location.pathname}?${search_params.toString()}`);
};

return (
Expand Down

0 comments on commit a72d049

Please sign in to comment.