Skip to content

Commit

Permalink
Merge pull request #293 from rupato-deriv/Rupato/Fix--add-additional-…
Browse files Browse the repository at this point in the history
…state-to-query-param

fix: currency param
  • Loading branch information
rupato-deriv authored Mar 3, 2025
2 parents 9a23638 + 2cbc5fe commit d1798a3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/pages/callback/callback-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,19 @@ const CallbackPage = () => {
.filter(key => key.startsWith('cur'))
.map(key => tokens[key]);
const is_valid_currency = currencies.includes(state?.account || currency || '');
const selected_currency = is_valid_currency ? state?.account || currency : 'USD';

const firstAccountKey = tokens.acct1;
const firstAccountCurrency = clientAccounts[firstAccountKey]
? clientAccounts[firstAccountKey].currency
: null;
const selected_currency =
(is_valid_currency ? state?.account?.currency || currency : currency) || firstAccountCurrency;
console.log('selected_currency', {
firstAccountCurrency,
stateAccountCurrency: state?.account?.currency,
currency,
selected_currency,
});
window.location.assign(`/?account=${selected_currency}`);
}}
renderReturnButton={() => {
Expand Down

0 comments on commit d1798a3

Please sign in to comment.