diff --git a/Dockerfile b/Dockerfile index c708227b..38a2a49a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ WORKDIR /app ENV HUSKY=0 -RUN git clone https://github.com/deriv-com/p2p.git . +COPY . . RUN npm install diff --git a/src/App.tsx b/src/App.tsx index 7a490391..4614194e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,12 +3,13 @@ import { BrowserRouter } from 'react-router-dom'; import { QueryParamProvider } from 'use-query-params'; import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5'; import { AppFooter, AppHeader, DerivIframe, ErrorBoundary } from '@/components'; -import { useDerivAnalytics, useRedirectToOauth, useTrackjs } from '@/hooks'; +import { useDerivAnalytics, useOAuth, useTrackjs } from '@/hooks'; import AppContent from '@/routes/AppContent'; import { initializeI18n, TranslationProvider } from '@deriv-com/translations'; import { Loader, useDevice } from '@deriv-com/ui'; import { URLConstants } from '@deriv-com/utils'; import useGrowthbookGetFeatureValue from './hooks/custom-hooks/useGrowthbookGetFeatureValue'; +import useOAuth2Enabled from './hooks/custom-hooks/useOAuth2Enabled'; const { VITE_CROWDIN_BRANCH_NAME, VITE_PROJECT_NAME, VITE_TRANSLATIONS_CDN_URL } = process.env; const i18nInstance = initializeI18n({ @@ -19,14 +20,15 @@ const App = () => { const [ShouldRedirectToDerivApp, isGBLoaded] = useGrowthbookGetFeatureValue({ featureFlag: 'redirect_to_deriv_app_p2p', }); + const [isOAuth2Enabled] = useOAuth2Enabled(); + const { onRenderAuthCheck } = useOAuth(); const { init: initTrackJS } = useTrackjs(); const { isDesktop } = useDevice(); - const { redirectToOauth } = useRedirectToOauth(); const { initialise: initDerivAnalytics } = useDerivAnalytics(); initTrackJS(); initDerivAnalytics(); - redirectToOauth(); + onRenderAuthCheck(); useEffect(() => { if (isGBLoaded && ShouldRedirectToDerivApp) { @@ -42,7 +44,7 @@ const App = () => { }> - + {!isOAuth2Enabled && } {isDesktop && } diff --git a/src/components/AppHeader/AppHeader.tsx b/src/components/AppHeader/AppHeader.tsx index bd496b66..aa9b3846 100644 --- a/src/components/AppHeader/AppHeader.tsx +++ b/src/components/AppHeader/AppHeader.tsx @@ -1,5 +1,5 @@ import { getOauthUrl } from '@/constants'; -import { api, useRedirectToOauth } from '@/hooks'; +import { api, useOAuth } from '@/hooks'; import { getCurrentRoute } from '@/utils'; import { StandaloneCircleUserRegularIcon } from '@deriv/quill-icons'; import { useAuthData } from '@deriv-com/api-hooks'; @@ -19,11 +19,11 @@ import './AppHeader.scss'; const AppHeader = () => { const { isDesktop } = useDevice(); const isEndpointPage = getCurrentRoute() === 'endpoint'; - const { redirectToOauth } = useRedirectToOauth(); - const { activeLoginid, logout } = useAuthData(); + const { activeLoginid } = useAuthData(); const { data: activeAccount } = api.account.useActiveAccount(); const { localize } = useTranslations(); const oauthUrl = getOauthUrl(); + const { oAuthLogout } = useOAuth(); const renderAccountSection = () => { if (!isEndpointPage && !activeAccount) { @@ -47,14 +47,7 @@ const AppHeader = () => { )} -