로그인 쪽 url 수정

This commit is contained in:
hyeonsu 2025-09-04 17:31:45 +09:00
parent 40d8fa605b
commit 5e13f16e73
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from "react"; import { useState, useEffect, useCallback } from "react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { apiCall } from "@/lib/api/client"; import { apiCall, API_BASE_URL } from "@/lib/api/client";
// 사용자 정보 타입 정의 // 사용자 정보 타입 정의
interface UserInfo { interface UserInfo {
@ -98,8 +98,7 @@ export const useAuth = () => {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
// API 기본 URL 설정 // API 기본 URL 설정 (동적으로 결정)
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || "http://39.117.244.52:8080/api";
/** /**
* *

View File

@ -4,6 +4,7 @@ import { useState, useEffect, useCallback } from "react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { LoginFormData, LoginResponse } from "@/types/auth"; import { LoginFormData, LoginResponse } from "@/types/auth";
import { AUTH_CONFIG, FORM_VALIDATION } from "@/constants/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 * API
*/ */
const apiCall = useCallback(async (endpoint: string, options: RequestInit = {}): Promise<LoginResponse> => { const apiCall = useCallback(async (endpoint: string, options: RequestInit = {}): Promise<LoginResponse> => {
const response = await fetch(`${AUTH_CONFIG.API_BASE_URL}${endpoint}`, { const response = await fetch(`${API_BASE_URL}${endpoint}`, {
credentials: "include", credentials: "include",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",