Spaces:
Runtime error
Runtime error
| // Dynamic API URL resolution for local and production environments. | |
| // When the page is served by the Flask server itself (any port), the API lives | |
| // on the same origin. Only the Vite dev server (port 5173) needs the explicit | |
| // backend address. | |
| const isViteDev = window.location.port === '5173'; | |
| export const API_BASE_URL = (import.meta.env.VITE_API_URL as string) || | |
| (isViteDev ? 'http://127.0.0.1:8000' : window.location.origin); | |