From d70b5d42838730458de683cebf13865abc9e757b Mon Sep 17 00:00:00 2001 From: Daniil Chemerkin Date: Sat, 12 Jul 2025 23:29:59 +0000 Subject: [PATCH] Hotfix/change domain --- src/components/App/index.tsx | 40 ++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index afaeb0a..f1707f5 100755 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -1,12 +1,10 @@ import { - useCallback, - useEffect, - useLayoutEffect, - useMemo, - useRef, - // useMemo, - // useRef, useState, + useEffect, + useRef, + useCallback, + useMemo, + useLayoutEffect } from "react"; import { Routes, @@ -155,6 +153,7 @@ import CompatibilityV4Routes from "@/routerComponents/Compatibility/v4"; import { useUnleashClient } from "@unleash/proxy-client-react"; import { useSession } from "@/hooks/session/useSession"; import { getSourceByPathname } from "@/utils/source.utils"; +import { navigateToAuth } from "@/utils/auth-navigation"; import "../palmistry/palmistry-container/palmistry-container.css" import ProfileRoutes from "@/routerComponents/Profile"; @@ -1102,7 +1101,7 @@ function Layout(): JSX.Element { /> ) : null} {isRouteFullDataModal && ( - { }}> + setIsShowFullDataModal(false)}> )} @@ -1323,7 +1322,30 @@ function SkipStep(): JSX.Element { function MainPage(): JSX.Element { const status = useSelector(selectors.selectStatus); - return ; + const route = getRouteBy(status); + const [shouldRedirect, setShouldRedirect] = useState(false); + + useEffect(() => { + // Check if we're navigating to auth and on witlab.app domain + if (route === routes.client.auth()) { + const isWitlabDomain = window.location.hostname === 'witlab.app' || + window.location.hostname.endsWith('.witlab.app'); + + // If we're on witlab.app domain, use server-side navigation + if (isWitlabDomain) { + navigateToAuth(); + setShouldRedirect(true); + } + } + }, [route]); + + // If we're redirecting via server-side navigation, return empty fragment + if (shouldRedirect) { + return <>; + } + + // For all other cases, use client-side navigation + return ; } export default App;