Skip to content

Commit 75e4ebf

Browse files
committed
refactor: users v2 api 전환
1 parent f9b3a35 commit 75e4ebf

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/api/profile.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ export const profileApi = {
77
nickname?: string;
88
monthlyBudget?: number;
99
}) => {
10-
const response = await apiClient.patch('/api/v1/users/me', profileData);
10+
const response = await apiClient.patch('/api/v2/users/me', profileData);
1111
return response.data;
1212
},
1313

1414
// 프로필 이미지 업로드
1515
uploadAvatar: async (file: File) => {
1616
const formData = new FormData();
1717
formData.append('file', file);
18-
const response = await apiClient.post('/api/v1/users/me/profile-image', formData, {
18+
const response = await apiClient.post('/api/v2/users/me/profile-image', formData, {
1919
headers: {
2020
'Content-Type': 'multipart/form-data',
2121
},
@@ -25,20 +25,20 @@ export const profileApi = {
2525

2626
// 프로필 이미지 삭제
2727
deleteAvatar: async () => {
28-
const response = await apiClient.delete('/api/v1/users/me/profile-image');
28+
const response = await apiClient.delete('/api/v2/users/me/profile-image');
2929
return response.data;
3030
},
3131

3232
// 닉네임 중복 확인
3333
checkNickname: async (nickname: string) => {
3434
const encodedNickname = encodeURIComponent(nickname);
35-
const response = await apiClient.get(`/api/v1/users/nickname/check?nickname=${encodedNickname}`);
35+
const response = await apiClient.get(`/api/v2/users/nickname/check?nickname=${encodedNickname}`);
3636
return response.data;
3737
},
3838

3939
// 계정 삭제 (비활성화)
4040
deleteAccount: async () => {
41-
const response = await apiClient.delete('/api/v1/users/me');
41+
const response = await apiClient.delete('/api/v2/users/me');
4242
return response.data;
4343
}
4444
}

src/hooks/useAuth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const useAuth = () => {
4545
try {
4646
setIsLoading(true);
4747
console.log('사용자 정보 요청 시작')
48-
const response = await apiClient.get('/api/v1/auth/me');
48+
const response = await apiClient.get('/api/v2/auth/me');
4949
// console.log('/me 응답: ', response.status, response.data);
5050
const userData = response.data;
5151
// HTML 응답인지 확인
@@ -91,7 +91,7 @@ export const useAuth = () => {
9191
const logout = async () => {
9292
try {
9393
setIsLoading(true);
94-
await apiClient.post('/api/v1/auth/logout', {}, { timeout: 5000 });
94+
await apiClient.post('/api/v2/auth/logout', {}, { timeout: 5000 });
9595
console.log('서버 로그아웃 요청 성공');
9696
} catch (error) {
9797
console.error('로그아웃 실패: ', error);

src/utils/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const shouldSkipUnauthorizedHandling = (url: string, method: string) => {
7272

7373
// 계정삭제 API
7474
const isAccountDeletion =
75-
url?.includes("/api/v1/users/me") && method === "delete";
75+
url?.includes("/api/v2/users/me") && method === "delete";
7676

7777
const isMainRoot = currentPath === "/";
7878

@@ -85,7 +85,7 @@ const shouldSkipUnauthorizedHandling = (url: string, method: string) => {
8585
const handleRefreshToken = async (originalRequest: any) => {
8686
try {
8787
// 한번만 refresh 시도
88-
await apiClient.post("/api/v1/auth/refresh");
88+
await apiClient.post("/api/v2/auth/refresh");
8989
isHandling401 = false;
9090
// 성공하면 원래 요청 재시도
9191
return apiClient(originalRequest);

0 commit comments

Comments
 (0)