From d0d7f184e578a45968f38941a26aa42dc0293dc1 Mon Sep 17 00:00:00 2001 From: Junseo Kim Date: Sat, 21 Dec 2024 10:16:55 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EC=97=90=EC=84=9C=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EB=B3=80=EC=88=98=EB=A5=BC=20=ED=99=9C=EC=9A=A9=ED=95=9C=20API?= =?UTF-8?q?=20URL=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - REACT_APP_API_BASE_URL 환경변수를 사용하여 회원가입 API URL을 설정 - 코드의 가독성과 유지보수성을 높이기 위해 하드코딩된 URL 제거 - 배포 환경별 유연한 API URL 관리 가능 --- client/src/api/signUp.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; }); };