From 7d84d53d4b95732319d0b19c180201a14491068d Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Wed, 22 Oct 2025 14:04:58 +0400 Subject: fix/frontend: use API url based on environment (#282) --- frontend/src/api/Api.ts | 4 +++- frontend/src/vite-env.d.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 frontend/src/vite-env.d.ts (limited to 'frontend') diff --git a/frontend/src/api/Api.ts b/frontend/src/api/Api.ts index df787e3..19ece86 100644 --- a/frontend/src/api/Api.ts +++ b/frontend/src/api/Api.ts @@ -49,7 +49,9 @@ export const API = { delete_map_summary: (token: string, map_id: string, route_id: number) => delete_map_summary(token, map_id, route_id), }; -const BASE_API_URL: string = "https://lp.portal2.sr/api/v1/" +const BASE_API_URL: string = import.meta.env.DEV + ? "https://lp.portal2.sr/api/v1/" + : "/api/v1/" export function url(path: string): string { return BASE_API_URL + path; diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts new file mode 100644 index 0000000..ed77210 --- /dev/null +++ b/frontend/src/vite-env.d.ts @@ -0,0 +1,2 @@ +/// + -- cgit v1.2.3