Skip to content

Commit 34279d4

Browse files
committed
hotfix: 백엔드 개발 서버 경로 수정
1 parent 9f88b59 commit 34279d4

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

src/api/config.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
import axios from "axios";
22

3-
const rawServerUri =
4-
import.meta.env.VITE_SERVER_URI ||
5-
(typeof window !== "undefined" ? window.location.origin : "");
3+
const PROD_BACKEND_ORIGIN = "https://129.154.54.225.nip.io";
4+
5+
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+
return PROD_BACKEND_ORIGIN;
17+
}
18+
19+
return origin;
20+
};
21+
22+
const rawServerUri = resolveServerUri();
623

724
export const SERVER_URI = rawServerUri ? rawServerUri.replace(/\/$/, "") : "";
825

0 commit comments

Comments
 (0)