File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed
Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ declare global {
1818export default function ApiDocs ( ) {
1919 const { isDark } = useThemeStore ( )
2020 // Use runtime config first, then build-time env, then default
21- const apiBaseUrl = window . __ENV__ ?. VITE_API_BASE_URL || import . meta. env . VITE_API_BASE_URL || '/api'
21+ // Remove trailing slash to avoid double slashes in URLs
22+ const rawApiBaseUrl = window . __ENV__ ?. VITE_API_BASE_URL || import . meta. env . VITE_API_BASE_URL || '/api'
23+ const apiBaseUrl = rawApiBaseUrl . replace ( / \/ + $ / , '' )
2224
2325 useEffect ( ( ) => {
2426 // Hide the "Explore" link and customize Swagger UI colors
Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ declare global {
1212}
1313
1414// Use runtime config first, then build-time env, then default
15- const API_BASE_URL = window . __ENV__ ?. VITE_API_BASE_URL || import . meta. env . VITE_API_BASE_URL || '/api'
15+ // Remove trailing slash to avoid double slashes in URLs
16+ const rawApiBaseUrl = window . __ENV__ ?. VITE_API_BASE_URL || import . meta. env . VITE_API_BASE_URL || '/api'
17+ const API_BASE_URL = rawApiBaseUrl . replace ( / \/ + $ / , '' )
1618
1719export default function ConsentRedirect ( ) {
1820 const [ searchParams ] = useSearchParams ( )
Original file line number Diff line number Diff line change @@ -15,7 +15,9 @@ declare global {
1515}
1616
1717// Use runtime config first, then build-time env, then default
18- const API_BASE_URL = window . __ENV__ ?. VITE_API_BASE_URL || import . meta. env . VITE_API_BASE_URL || '/api'
18+ // Remove trailing slash to avoid double slashes in URLs
19+ const rawApiBaseUrl = window . __ENV__ ?. VITE_API_BASE_URL || import . meta. env . VITE_API_BASE_URL || '/api'
20+ const API_BASE_URL = rawApiBaseUrl . replace ( / \/ + $ / , '' )
1921
2022// Global flag to track redirect across component remounts (persists until page reload)
2123declare global {
Original file line number Diff line number Diff line change 11import { useEffect , useState } from 'react'
22import { useNavigate , useSearchParams } from 'react-router-dom'
33
4+ // Runtime environment from env.js (generated at container startup)
5+ declare global {
6+ interface Window {
7+ __ENV__ ?: {
8+ VITE_API_BASE_URL ?: string
9+ VITE_BACKEND_URL ?: string
10+ }
11+ }
12+ }
13+
414export default function VerifyEmail ( ) {
515 const [ searchParams ] = useSearchParams ( )
616 const navigate = useNavigate ( )
717 const [ status , setStatus ] = useState < 'loading' | 'success' | 'error' > ( 'loading' )
818 const [ message , setMessage ] = useState ( '' )
919
10- const apiBaseUrl = import . meta. env . VITE_API_BASE_URL || 'http://localhost:8000'
20+ // Use runtime config first, then build-time env, then default
21+ // Remove trailing slash to avoid double slashes in URLs
22+ const rawApiBaseUrl = window . __ENV__ ?. VITE_API_BASE_URL || import . meta. env . VITE_API_BASE_URL || '/api'
23+ const apiBaseUrl = rawApiBaseUrl . replace ( / \/ + $ / , '' )
1124
1225 useEffect ( ( ) => {
1326 const token = searchParams . get ( 'token' )
You can’t perform that action at this time.
0 commit comments