/** * API URL 유틸리티 * 프로덕션/개발 환경에 따라 올바른 API URL을 반환 */ export function getApiUrl(endpoint: string): string { // 클라이언트 사이드에서만 실행 if (typeof window !== "undefined") { const hostname = window.location.hostname; // 프로덕션: *.invyone.com (solution, v1 등 모든 alias) → https://api.invyone.com if (hostname.endsWith(".invyone.com")) { return `https://api.invyone.com${endpoint}`; } // 로컬 개발: localhost → http://localhost:8081 if (hostname === "localhost" || hostname === "127.0.0.1") { return `http://localhost:8081${endpoint}`; } } // 기본값: 상대 경로 return endpoint; }