From e3cb8f9e2d4c1c99454e5827d3bf04bcee51c440 Mon Sep 17 00:00:00 2001 From: Dilusha-Madushan Date: Thu, 28 May 2026 17:45:25 +0530 Subject: [PATCH] Fix afterSignUpUrl base path in SignUpBox to include BASE_URL prefix --- .../apps/gate/src/components/SignUp/SignUpBox.tsx | 11 ++++++++--- .../components/SignUp/__tests__/SignUpBox.test.tsx | 11 +++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/apps/gate/src/components/SignUp/SignUpBox.tsx b/frontend/apps/gate/src/components/SignUp/SignUpBox.tsx index d33c9948a5..a5fca2cf0c 100644 --- a/frontend/apps/gate/src/components/SignUp/SignUpBox.tsx +++ b/frontend/apps/gate/src/components/SignUp/SignUpBox.tsx @@ -37,7 +37,12 @@ export default function SignUpBox(): JSX.Element { const {isDesignEnabled} = useDesign(); const [flowError, setFlowError] = useState(null); - const signInUrl = ROUTES.AUTH.SIGN_IN; + // For React Router navigate() — basename is handled by the router. + const signInPath = ROUTES.AUTH.SIGN_IN; + // For window.location.href and new URL() (via afterSignUpUrl) — React Router basename is + // bypassed, so an absolute URL with origin + base path must be constructed explicitly. + // Vite appends a trailing slash to BASE_URL. + const afterSignUpUrl = `${window.location.origin}${import.meta.env.BASE_URL.replace(/\/$/, '')}${signInPath}`; const renderFlowContent = ( components: EmbeddedFlowComponent[], @@ -103,7 +108,7 @@ export default function SignUpBox(): JSX.Element { logoDisplay={!isDesignEnabled ? {xs: 'flex', md: 'none'} : {display: 'none'}} > { if (response?.failureReason) { setFlowError(response.failureReason as string); @@ -151,7 +156,7 @@ export default function SignUpBox(): JSX.Element {