From 5e13f16e734ac5e92e3efc3a540647315ae55be4 Mon Sep 17 00:00:00 2001 From: hyeonsu Date: Thu, 4 Sep 2025 17:31:45 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=AA=BD=20url?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/hooks/useAuth.ts | 5 ++--- frontend/hooks/useLogin.ts | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/hooks/useAuth.ts b/frontend/hooks/useAuth.ts index 3078ca29..99376992 100644 --- a/frontend/hooks/useAuth.ts +++ b/frontend/hooks/useAuth.ts @@ -1,6 +1,6 @@ import { useState, useEffect, useCallback } from "react"; import { useRouter } from "next/navigation"; -import { apiCall } from "@/lib/api/client"; +import { apiCall, API_BASE_URL } from "@/lib/api/client"; // 사용자 정보 타입 정의 interface UserInfo { @@ -98,8 +98,7 @@ export const useAuth = () => { const [loading, setLoading] = useState(true); const [error, setError] = useState(null); - // API 기본 URL 설정 - const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://39.117.244.52:8080/api"; + // API 기본 URL 설정 (동적으로 결정) /** * 현재 사용자 정보 조회 diff --git a/frontend/hooks/useLogin.ts b/frontend/hooks/useLogin.ts index 733716d6..5abffac9 100644 --- a/frontend/hooks/useLogin.ts +++ b/frontend/hooks/useLogin.ts @@ -4,6 +4,7 @@ import { useState, useEffect, useCallback } from "react"; import { useRouter } from "next/navigation"; import { LoginFormData, LoginResponse } from "@/types/auth"; import { AUTH_CONFIG, FORM_VALIDATION } from "@/constants/auth"; +import { API_BASE_URL } from "@/lib/api/client"; /** * 로그인 관련 비즈니스 로직을 관리하는 커스텀 훅 @@ -60,7 +61,7 @@ export const useLogin = () => { * API 호출 공통 함수 */ const apiCall = useCallback(async (endpoint: string, options: RequestInit = {}): Promise => { - const response = await fetch(`${AUTH_CONFIG.API_BASE_URL}${endpoint}`, { + const response = await fetch(`${API_BASE_URL}${endpoint}`, { credentials: "include", headers: { "Content-Type": "application/json",