We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a79be1 commit 6cbbdfbCopy full SHA for 6cbbdfb
src/lib/config.ts
@@ -1,5 +1,9 @@
1
// Backend API configuration
2
-export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
+// Use environment var if provided; otherwise default to same-origin
3
+const ENV_API_BASE_URL = import.meta.env.VITE_API_BASE_URL as string | undefined;
4
+export const API_BASE_URL = (ENV_API_BASE_URL && ENV_API_BASE_URL.trim() !== "")
5
+ ? ENV_API_BASE_URL
6
+ : window.location.origin;
7
8
9
// API endpoints
0 commit comments