File size: 444 Bytes
5752a28
 
 
 
 
 
 
1
2
3
4
5
6
7
8
// 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);