Skip to content

Commit

Permalink
fix: added cookies to fix silent login
Browse files Browse the repository at this point in the history
  • Loading branch information
rupato-deriv committed Feb 17, 2025
1 parent 19740ef commit 3d01382
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ function App() {

React.useEffect(() => {
const accounts_list = localStorage.getItem('accountsList');
const client_accounts = localStorage.getItem('clientAccounts');
const stored_accounts = JSON.parse(localStorage.getItem('clientAccounts') || '{}');
const cookie_accounts = Cookies.get('client.accounts') || '{}';
const client_accounts = {
...stored_accounts,
...JSON.parse(cookie_accounts),
};
console.log(client_accounts);
const active_loginid = Cookies.get('active_loginid') || localStorage.getItem('active_loginid');
console.log('test from app', {
active_loginid,
Expand All @@ -90,6 +96,7 @@ function App() {
([/* eslint-disable-line @typescript-eslint/no-unused-vars */ _, account]) =>
account.loginid === active_loginid
);
console.log(selected_account);
if (!selected_account) return;
const [/* eslint-disable-line @typescript-eslint/no-unused-vars */ _, account] = selected_account;
updateAccountParamInURL(account);
Expand Down

0 comments on commit 3d01382

Please sign in to comment.