@@ -2,6 +2,7 @@ import { useEffect } from 'react';
2
2
import clsx from 'clsx' ;
3
3
import Cookies from 'js-cookie' ;
4
4
import { Outlet } from 'react-router-dom' ;
5
+ import { api_base } from '@/external/bot-skeleton' ;
5
6
import { useOauth2 } from '@/hooks/auth/useOauth2' ;
6
7
import { requestOidcAuthentication } from '@deriv-com/auth-client' ;
7
8
import { useDevice } from '@deriv-com/ui' ;
@@ -10,12 +11,6 @@ import AppHeader from './header';
10
11
import Body from './main-body' ;
11
12
import './layout.scss' ;
12
13
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
-
19
14
const Layout = ( ) => {
20
15
const { isDesktop } = useDevice ( ) ;
21
16
@@ -26,19 +21,17 @@ const Layout = () => {
26
21
const isEndpointPage = window . location . pathname . includes ( 'endpoint' ) ;
27
22
const checkClientAccount = JSON . parse ( localStorage . getItem ( 'clientAccounts' ) ?? '{}' ) ;
28
23
const checkAccountList = JSON . parse ( localStorage . getItem ( 'accountList' ) ?? '{}' ) ;
29
- const cookiesAccount = JSON . parse ( Cookies . get ( 'client.accounts' ) ?? '{}' ) ;
30
- const isAccountPresent = hasAllKeys ( checkClientAccount , cookiesAccount ) ;
31
24
32
- console . log ( 'clientAccounts' , { cookiesAccount , checkClientAccount, checkAccountList, isAccountPresent } ) ;
25
+ console . log ( 'clientAccounts' , { checkClientAccount, checkAccountList, api_base } ) ;
33
26
34
27
useEffect ( ( ) => {
35
- if ( isLoggedInCookie && isOAuth2Enabled && ! isEndpointPage && ! isCallbackPage && ! isAccountPresent ) {
28
+ if ( isLoggedInCookie && isOAuth2Enabled && ! isEndpointPage && ! isCallbackPage ) {
36
29
console . log ( 'requestOidcAuthentication' ) ;
37
30
requestOidcAuthentication ( {
38
31
redirectCallbackUri : `${ window . location . origin } /callback` ,
39
32
} ) ;
40
33
}
41
- } , [ isLoggedInCookie , isOAuth2Enabled , isEndpointPage , isCallbackPage , isAccountPresent ] ) ;
34
+ } , [ isLoggedInCookie , isOAuth2Enabled , isEndpointPage , isCallbackPage ] ) ;
42
35
43
36
return (
44
37
< div className = { clsx ( 'layout' , { responsive : isDesktop } ) } >
0 commit comments