File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { useFirebaseCountriesConfig } from '@/hooks/firebase/useFirebaseCountrie
1010import { useApiBase } from '@/hooks/useApiBase' ;
1111import { useStore } from '@/hooks/useStore' ;
1212import useTMB from '@/hooks/useTMB' ;
13- import { handleOidcAuthFailure } from '@/utils/auth-utils' ;
13+ import { clearAuthData , handleOidcAuthFailure } from '@/utils/auth-utils' ;
1414import { StandaloneCircleUserRegularIcon } from '@deriv/quill-icons/Standalone' ;
1515import { requestOidcAuthentication } from '@deriv-com/auth-client' ;
1616import { Localize , useTranslations } from '@deriv-com/translations' ;
@@ -138,6 +138,7 @@ const AppHeader = observer(({ isAuthenticating }: TAppHeaderProps) => {
138138 < Button
139139 tertiary
140140 onClick = { async ( ) => {
141+ clearAuthData ( false ) ;
141142 const getQueryParams = new URLSearchParams ( window . location . search ) ;
142143 const currency = getQueryParams . get ( 'account' ) ?? '' ;
143144 const query_param_currency =
Original file line number Diff line number Diff line change @@ -6,15 +6,17 @@ import Cookies from 'js-cookie';
66/**
77 * Clears authentication data from local storage and reloads the page
88 */
9- export const clearAuthData = ( ) : void => {
9+ export const clearAuthData = ( is_reload : boolean = true ) : void => {
1010 localStorage . removeItem ( 'accountsList' ) ;
1111 localStorage . removeItem ( 'clientAccounts' ) ;
1212 localStorage . removeItem ( 'callback_token' ) ;
1313 localStorage . removeItem ( 'authToken' ) ;
1414 localStorage . removeItem ( 'active_loginid' ) ;
1515 localStorage . removeItem ( 'client.accounts' ) ;
1616 localStorage . removeItem ( 'client.country' ) ;
17- location . reload ( ) ;
17+ if ( is_reload ) {
18+ location . reload ( ) ;
19+ }
1820} ;
1921
2022/**
You can’t perform that action at this time.
0 commit comments