diff --git a/client/src/api/apiClient.ts b/client/src/api/apiClient.ts index 918e42e..168ec06 100644 --- a/client/src/api/apiClient.ts +++ b/client/src/api/apiClient.ts @@ -1,9 +1,11 @@ import axios from 'axios'; import Cookies from 'js-cookie'; +const apiBaseUrl = process.env.REACT_APP_API_BASE_URL; + // Axios 클라이언트 생성 const apiClient = axios.create({ - baseURL: 'http://34.64.179.51:8080/api', // 기본 API URL 설정 + baseURL: apiBaseUrl, // 기본 API URL 설정 }); // 요청 인터셉터 diff --git a/client/src/api/logIn.ts b/client/src/api/logIn.ts index 0f234b0..ecfc301 100644 --- a/client/src/api/logIn.ts +++ b/client/src/api/logIn.ts @@ -14,6 +14,9 @@ interface RegisterResponse { data: LoginData; } +// 환경변수에서 API URL 가져오기 +const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; + // 토큰 가져오기 함수 추가 export const getAccessToken = (): string | null => { return localStorage.getItem('accessToken'); @@ -54,7 +57,7 @@ export const logIn = async ( try { // 로그인 API 호출 const response = await axios.post( - 'http://34.64.179.51:8080/auth/admins/login', + `${API_BASE_URL}/auth/admins/login`, // 환경변수를 사용한 API URL { name: name, password: password, diff --git a/client/src/api/signUp.ts b/client/src/api/signUp.ts index 81780ee..2d6554c 100644 --- a/client/src/api/signUp.ts +++ b/client/src/api/signUp.ts @@ -1,12 +1,16 @@ import axios, {AxiosResponse} from 'axios'; +// 환경변수에서 API URL 가져오기 +const API_BASE_URL = process.env.REACT_APP_API_BASE_URL; + +// 회원가입 함수 export const signUp = ( name: string, password: string, email: string, ): Promise => { return axios - .post('http://34.64.179.51:8080/auth/admins/register', { + .post(`${API_BASE_URL}/auth/admins/register`, { name: name, password: password, email: email, @@ -15,7 +19,7 @@ export const signUp = ( return res; }) .catch(error => { - console.log('Failed to register admin:', error); + console.error('Failed to register admin:', error); return null; }); };