Skip to content

Commit

Permalink
Merge pull request #237 from farabi-deriv/farabi/webrel-3608/account-…
Browse files Browse the repository at this point in the history
…currency-param-not-set

Farabi/webrel-3608/account-currency-param-not-set
  • Loading branch information
farabi-deriv authored Jan 20, 2025
2 parents e72e35e + 9d28293 commit 8bdbedc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pages/callback/callback-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const CallbackPage = () => {
<Callback
onSignInSuccess={(tokens: Record<string, string>) => {
const accountsList: Record<string, string> = {};
const clientAccounts: Record<string, { loginid: string; token: string }> = {};
const clientAccounts: Record<string, { loginid: string; token: string; currency: string }> = {};

for (const [key, value] of Object.entries(tokens)) {
if (key.startsWith('acct')) {
Expand All @@ -16,8 +16,14 @@ const CallbackPage = () => {
clientAccounts[value] = {
loginid: value,
token: tokens[tokenKey],
currency: '',
};
}
} else if (key.startsWith('cur')) {
const accKey = key.replace('cur', 'acct');
if (tokens[accKey]) {
clientAccounts[tokens[accKey]].currency = value;
}
}
}

Expand All @@ -27,8 +33,6 @@ const CallbackPage = () => {
localStorage.setItem('authToken', tokens.token1);
localStorage.setItem('active_loginid', tokens.acct1);

localStorage.setItem('tokens object', JSON.stringify(tokens));

window.location.assign('/');
}}
renderReturnButton={() => {
Expand Down

0 comments on commit 8bdbedc

Please sign in to comment.