또 수정

This commit is contained in:
dohyeons
2025-10-02 17:28:52 +09:00
parent 0455b1ee43
commit c076cd0b14
3 changed files with 11 additions and 13 deletions

View File

@@ -34,6 +34,12 @@ export interface ValidationResult {
*/
// API URL 동적 설정 - 기존 client.ts와 동일한 로직
const getApiBaseUrl = (): string => {
// 1. 환경변수가 있으면 우선 사용
if (process.env.NEXT_PUBLIC_API_URL) {
return process.env.NEXT_PUBLIC_API_URL;
}
// 2. 클라이언트 사이드에서 동적 설정
if (typeof window !== "undefined") {
const currentHost = window.location.hostname;
const currentPort = window.location.port;
@@ -45,18 +51,10 @@ const getApiBaseUrl = (): string => {
) {
return "http://localhost:8080/api";
}
// 서버 환경에서 localhost:5555 → 39.117.244.52:8080
if ((currentHost === "localhost" || currentHost === "127.0.0.1") && currentPort === "5555") {
return "http://39.117.244.52:8080/api";
}
// 기타 서버 환경 (내부/외부 IP): → 39.117.244.52:8080
return "http://39.117.244.52:8080/api";
}
// 서버 사이드 렌더링 기본값
return "http://39.117.244.52:8080/api";
// 3. 기본값
return "http://localhost:8080/api";
};
export class ExternalCallAPI {