Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix search param check #282

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ function App() {
};
}, []);

const updateAccountParamInURL = (account_data: TAuthData['account_list'][number], fallback_currency = '') => {
const search_params = new URLSearchParams(window.location.search);
const account_param = account_data.loginid.startsWith('VR')
? 'demo'
: account_data.currency || fallback_currency;
search_params.set('account', account_param);
window.history.pushState({}, '', `${window.location.pathname}?${search_params.toString()}`);
};
// const updateAccountParamInURL = (account_data: TAuthData['account_list'][number], fallback_currency = '') => {
// const search_params = new URLSearchParams(window.location.search);
// const account_param = account_data.loginid.startsWith('VR')
// ? 'demo'
// : account_data.currency || fallback_currency;
// search_params.set('account', account_param);
// //window.history.pushState({}, '', `${window.location.pathname}?${search_params.toString()}`);
// };

React.useEffect(() => {
const accounts_list = localStorage.getItem('accountsList');
Expand All @@ -85,7 +85,7 @@ function App() {
);
if (!selected_account) return;
const [/* eslint-disable-line @typescript-eslint/no-unused-vars */ _, account] = selected_account;
updateAccountParamInURL(account);
//updateAccountParamInURL(account);
} catch (e) {
console.warn('Error', e); // eslint-disable-line no-console
}
Expand Down Expand Up @@ -142,7 +142,7 @@ function App() {
);
if (!selected_account) return;
const [_, account] = selected_account; // eslint-disable-line @typescript-eslint/no-unused-vars
updateAccountParamInURL(account, 'USD');
//updateAccountParamInURL(account, 'USD');
}
} catch (e) {
console.warn('Error', e); // eslint-disable-line no-console
Expand Down
Loading