Skip to content

Commit 8116530

Browse files
authored
Merge pull request #277 from rupato-deriv/Fix-oidc-check
fix: removed extra check
2 parents a787d52 + f844b12 commit 8116530

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/components/layout/index.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useEffect } from 'react';
22
import clsx from 'clsx';
33
import Cookies from 'js-cookie';
44
import { Outlet } from 'react-router-dom';
5+
import { api_base } from '@/external/bot-skeleton';
56
import { useOauth2 } from '@/hooks/auth/useOauth2';
67
import { requestOidcAuthentication } from '@deriv-com/auth-client';
78
import { useDevice } from '@deriv-com/ui';
@@ -10,12 +11,6 @@ import AppHeader from './header';
1011
import Body from './main-body';
1112
import './layout.scss';
1213

13-
function hasAllKeys(obj1, obj2) {
14-
const keys1 = Object.keys(obj1);
15-
const keys2 = new Set(Object.keys(obj2));
16-
return keys1.every(key => keys2.has(key));
17-
}
18-
1914
const Layout = () => {
2015
const { isDesktop } = useDevice();
2116

@@ -26,19 +21,17 @@ const Layout = () => {
2621
const isEndpointPage = window.location.pathname.includes('endpoint');
2722
const checkClientAccount = JSON.parse(localStorage.getItem('clientAccounts') ?? '{}');
2823
const checkAccountList = JSON.parse(localStorage.getItem('accountList') ?? '{}');
29-
const cookiesAccount = JSON.parse(Cookies.get('client.accounts') ?? '{}');
30-
const isAccountPresent = hasAllKeys(checkClientAccount, cookiesAccount);
3124

32-
console.log('clientAccounts', { cookiesAccount, checkClientAccount, checkAccountList, isAccountPresent });
25+
console.log('clientAccounts', { checkClientAccount, checkAccountList, api_base });
3326

3427
useEffect(() => {
35-
if (isLoggedInCookie && isOAuth2Enabled && !isEndpointPage && !isCallbackPage && !isAccountPresent) {
28+
if (isLoggedInCookie && isOAuth2Enabled && !isEndpointPage && !isCallbackPage) {
3629
console.log('requestOidcAuthentication');
3730
requestOidcAuthentication({
3831
redirectCallbackUri: `${window.location.origin}/callback`,
3932
});
4033
}
41-
}, [isLoggedInCookie, isOAuth2Enabled, isEndpointPage, isCallbackPage, isAccountPresent]);
34+
}, [isLoggedInCookie, isOAuth2Enabled, isEndpointPage, isCallbackPage]);
4235

4336
return (
4437
<div className={clsx('layout', { responsive: isDesktop })}>

0 commit comments

Comments
 (0)