From af787ace9d05c8a312a2de32cf8edc3c89080082 Mon Sep 17 00:00:00 2001 From: Sandeep Date: Mon, 14 Oct 2024 18:43:45 +0800 Subject: [PATCH] refactor: :fire: updated oauth2logout in current logout facility --- src/hooks/useLogout/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/hooks/useLogout/index.tsx b/src/hooks/useLogout/index.tsx index 4fd4b9bfa..a495567ed 100644 --- a/src/hooks/useLogout/index.tsx +++ b/src/hooks/useLogout/index.tsx @@ -1,9 +1,15 @@ import apiManager from '@site/src/configs/websocket'; import { useCallback } from 'react'; import useAuthContext from '../useAuthContext'; +import useGrowthbookGetFeatureValue from '../useGrowthbookGetFeatureValue'; +import { useOAuth2, TOAuth2EnabledAppList } from '@deriv-com/auth-client'; const useLogout = () => { const { updateLoginAccounts, updateCurrentLoginAccount } = useAuthContext(); + const [OAuth2EnabledApps, OAuth2EnabledAppsInitialised] = + useGrowthbookGetFeatureValue({ + featureFlag: 'hydra_be', + }); // we clean up everything related to the user here, for now it's just user's account // later on we should clear user tokens as well @@ -17,7 +23,9 @@ const useLogout = () => { }); }, [updateCurrentLoginAccount, updateLoginAccounts]); - return { logout }; + const { OAuth2Logout } = useOAuth2({ OAuth2EnabledApps, OAuth2EnabledAppsInitialised }, logout); + + return { logout: OAuth2Logout }; }; export default useLogout;