Skip to content

Commit

Permalink
feat: 회원가입 함수에서 환경변수를 활용한 API URL 설정
Browse files Browse the repository at this point in the history
- REACT_APP_API_BASE_URL 환경변수를 사용하여 회원가입 API URL을 설정
- 코드의 가독성과 유지보수성을 높이기 위해 하드코딩된 URL 제거
- 배포 환경별 유연한 API URL 관리 가능
  • Loading branch information
oesnuj committed Dec 21, 2024
1 parent 5f6e6e7 commit d0d7f18
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions client/src/api/signUp.ts
Original file line number Diff line number Diff line change
@@ -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<AxiosResponse | null> => {
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,
Expand All @@ -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;
});
};

0 comments on commit d0d7f18

Please sign in to comment.