Skip to content

Commit

Permalink
fix: silent login
Browse files Browse the repository at this point in the history
  • Loading branch information
rupato-deriv committed Feb 17, 2025
2 parents 9f6ee72 + d289df4 commit 30bc41e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,21 @@ function App() {

React.useEffect(() => {
const accounts_list = JSON.parse(localStorage.getItem('accountsList') || '{}');
const stored_accounts = JSON.parse(localStorage.getItem('clientAccounts') || '{}');
const cookie_accounts = Cookies.get('client.accounts') || '{}';
const stored_accounts = JSON.parse(localStorage.getItem('clientAccounts') || '{}');

if (Array.isArray(cookie_accounts)) {
cookie_accounts.forEach(data => {
const loginid = data.loginid;
accounts_list[loginid] = data.token;
});

localStorage.setItem('accountsList', JSON.stringify(accounts_list));
} else {
console.error('Invalid cookie_accounts format');
}
localStorage.setItem('accountsList', JSON.stringify(accounts_list));

const client_accounts = {
...stored_accounts,
...JSON.parse(cookie_accounts),
Expand Down

0 comments on commit 30bc41e

Please sign in to comment.