Skip to content

Commit 1df6d60

Browse files
authored
Merge pull request #286 from rupato-deriv/fix--OIDC-setup
fix: silent login
2 parents 7398989 + 3075e56 commit 1df6d60

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/components/layout/index.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const Layout = () => {
2929
Object.values(checkClientAccount).some(account => account.currency === currency) ||
3030
currency === 'demo' ||
3131
currency === '';
32-
const [clientHasCurrency, setClientHasCurrency] = useState(ifClientAccountHasCurrency);
32+
const [clientHasCurrency] = useState(ifClientAccountHasCurrency);
3333

3434
const validCurrencies = [...fiat_currencies_display_order, ...crypto_currencies_display_order];
3535
const query_currency = (getQueryParams.get('account') ?? '')?.toUpperCase();
@@ -40,11 +40,17 @@ const Layout = () => {
4040
const validateApiAccounts = ({ data }: any) => {
4141
if (data.msg_type === 'authorize') {
4242
api_accounts.push(data.authorize.account_list || []);
43+
console.log('api_accounts', api_accounts);
44+
console.log('checkClientAccount', checkClientAccount);
4345
api_accounts?.flat().map(data => {
4446
Object.values(checkClientAccount).map(key => {
47+
console.log('outside data.currency', data.currency);
48+
console.log('outside key.currency', key.currency);
4549
if (data.currency !== key.currency) {
4650
console.log('setClientHasCurrency');
47-
setClientHasCurrency(false);
51+
console.log('data.currency', data.currency);
52+
console.log('key.currency', key.currency);
53+
//setClientHasCurrency(false);
4854
}
4955
});
5056
});
@@ -62,11 +68,10 @@ const Layout = () => {
6268
}
6369
}, []);
6470

71+
console.log('clientHasCurrency', clientHasCurrency);
72+
6573
useEffect(() => {
66-
if (
67-
(isLoggedInCookie && !isClientAccountsPopulated && isOAuth2Enabled && !isEndpointPage && !isCallbackPage) ||
68-
!clientHasCurrency
69-
) {
74+
if (isLoggedInCookie && !isClientAccountsPopulated && isOAuth2Enabled && !isEndpointPage && !isCallbackPage) {
7075
console.log('requestOidcAuthentication');
7176
requestOidcAuthentication({
7277
redirectCallbackUri: `${window.location.origin}/callback`,

0 commit comments

Comments
 (0)