mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 04:08:11 +00:00
update
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
// API host is env-driven (set VITE_API_URL per environment, e.g. the remote
|
||||
// https://edrfreightapi.triaplc.com for prod). Falls back to the local API for dev.
|
||||
export const API_BASE_URL =
|
||||
(import.meta.env.VITE_API_URL as string | undefined) ?? 'http://localhost:3001';
|
||||
// Accept either a host-only URL or one that already ends with `/api`.
|
||||
// The HTTP client appends `/api` itself, so we normalize here to avoid
|
||||
// accidental `/api/api/...` requests from env values.
|
||||
const rawApiBaseUrl =
|
||||
(import.meta.env.VITE_API_URL as string | undefined) ?? "http://localhost:3001";
|
||||
|
||||
export const API_BASE_URL = rawApiBaseUrl
|
||||
.trim()
|
||||
.replace(/\/+$/, "")
|
||||
.replace(/\/api$/, "");
|
||||
|
||||
Reference in New Issue
Block a user