Skip to content

Commit d1798a3

Browse files
authored
Merge pull request #293 from rupato-deriv/Rupato/Fix--add-additional-state-to-query-param
fix: currency param
2 parents 9a23638 + 2cbc5fe commit d1798a3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/pages/callback/callback-page.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,19 @@ const CallbackPage = () => {
5757
.filter(key => key.startsWith('cur'))
5858
.map(key => tokens[key]);
5959
const is_valid_currency = currencies.includes(state?.account || currency || '');
60-
const selected_currency = is_valid_currency ? state?.account || currency : 'USD';
60+
61+
const firstAccountKey = tokens.acct1;
62+
const firstAccountCurrency = clientAccounts[firstAccountKey]
63+
? clientAccounts[firstAccountKey].currency
64+
: null;
65+
const selected_currency =
66+
(is_valid_currency ? state?.account?.currency || currency : currency) || firstAccountCurrency;
67+
console.log('selected_currency', {
68+
firstAccountCurrency,
69+
stateAccountCurrency: state?.account?.currency,
70+
currency,
71+
selected_currency,
72+
});
6173
window.location.assign(`/?account=${selected_currency}`);
6274
}}
6375
renderReturnButton={() => {

0 commit comments

Comments
 (0)