We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f88b59 commit 34279d4Copy full SHA for 34279d4
1 file changed
src/api/config.ts
@@ -1,8 +1,25 @@
1
import axios from "axios";
2
3
-const rawServerUri =
4
- import.meta.env.VITE_SERVER_URI ||
5
- (typeof window !== "undefined" ? window.location.origin : "");
+const PROD_BACKEND_ORIGIN = "https://129.154.54.225.nip.io";
+
+const resolveServerUri = () => {
6
+ if (import.meta.env.VITE_SERVER_URI) {
7
+ return import.meta.env.VITE_SERVER_URI;
8
+ }
9
10
+ if (typeof window === "undefined") {
11
+ return PROD_BACKEND_ORIGIN;
12
13
14
+ const { origin, hostname } = window.location;
15
+ if (hostname.endsWith("vercel.app")) {
16
17
18
19
+ return origin;
20
+};
21
22
+const rawServerUri = resolveServerUri();
23
24
export const SERVER_URI = rawServerUri ? rawServerUri.replace(/\/$/, "") : "";
25
0 commit comments