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을 제거하고 환경별 설정 가능하도록 개선
- 유지보수성과 배포 환경의 유연성 향상
  • Loading branch information
oesnuj committed Dec 21, 2024
1 parent 023faaf commit 5f6e6e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/src/api/logIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -54,7 +57,7 @@ export const logIn = async (
try {
// 로그인 API 호출
const response = await axios.post<RegisterResponse>(
'http://34.64.179.51:8080/auth/admins/login',
`${API_BASE_URL}/auth/admins/login`, // 환경변수를 사용한 API URL
{
name: name,
password: password,
Expand Down

0 comments on commit 5f6e6e7

Please sign in to comment.