Skip to content

Commit

Permalink
chore: removed unrelated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienne-deriv committed Dec 31, 2024
1 parent 9d96787 commit 0373f20
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/hooks/useOAuth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ const LOGOUT_TIMEOUT = 10000;
* @returns {{ OAuth2Logout: () => Promise<void> }} - Object containing the OAuth2Logout function.
* @deprecated Please use OAuth2Logout function instead of this hook from the `@deriv-com/auth-client` package.
*/
export const useOAuth2 = (
OAuth2GrowthBookConfig: OAuth2GBConfig,
WSLogoutAndRedirect: () => Promise<void>,
isGBLoaded?: boolean
) => {
export const useOAuth2 = (OAuth2GrowthBookConfig: OAuth2GBConfig, WSLogoutAndRedirect: () => Promise<void>) => {
const { OAuth2EnabledApps, OAuth2EnabledAppsInitialised } = OAuth2GrowthBookConfig;
const isOAuth2Enabled = useIsOAuth2Enabled(OAuth2EnabledApps, OAuth2EnabledAppsInitialised);

Expand All @@ -45,14 +41,13 @@ export const useOAuth2 = (
};

const OAuth2Logout = useCallback(async () => {
if (!isGBLoaded) return
if (!isOAuth2Enabled) return WSLogoutAndRedirect();

const onMessage = (event: MessageEvent) => {
if (event.data === 'logout_complete') {
const domains = ['deriv.com', 'binary.sx', 'pages.dev', 'localhost'];
const currentDomain = window.location.hostname.split('.').slice(-2).join('.');
if (domains.includes(currentDomain) && isOAuth2Enabled) {
if (domains.includes(currentDomain)) {
Cookies.set('logged_state', 'false', {
expires: 30,
path: '/',
Expand Down

0 comments on commit 0373f20

Please sign in to comment.