Skip to content

Commit 40e5979

Browse files
authored
Merge pull request #208 from prgrms-aibe-devcourse/dev
dev to main
2 parents 2a0d1af + 1217e37 commit 40e5979

5 files changed

Lines changed: 25 additions & 23 deletions

File tree

src/api/expense.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const expenseAPI = {
5757
splitType: data.splitType,
5858
splitData: data.splitData,
5959
};
60-
endpoint = '/api/v1/expenses/group';
60+
endpoint = '/api/v2/expenses/group';
6161
} else {
6262
expenseData = {
6363
title: data.title,
@@ -66,7 +66,7 @@ export const expenseAPI = {
6666
date: data.date,
6767
memo: data.memo,
6868
};
69-
endpoint = '/api/v1/expenses/personal';
69+
endpoint = '/api/v2/expenses/personal';
7070
}
7171

7272
formData.append('expense', new Blob([JSON.stringify(expenseData)], {
@@ -91,7 +91,7 @@ export const expenseAPI = {
9191
year: number;
9292
month: number;
9393
}) => {
94-
const response = await apiClient.get('/api/v1/expenses/group/shares', { params });
94+
const response = await apiClient.get('/api/v2/expenses/group/shares', { params });
9595
return response.data;
9696
},
9797

@@ -104,7 +104,7 @@ export const expenseAPI = {
104104
category?: string;
105105
search?: string;
106106
}) => {
107-
const response = await apiClient.get(`/api/v1/expenses/group/${groupId}/shares/paging`, { params });
107+
const response = await apiClient.get(`/api/v2/expenses/group/${groupId}/shares/paging`, { params });
108108
return response.data;
109109
},
110110

@@ -117,7 +117,7 @@ export const expenseAPI = {
117117
category?: string;
118118
search?: string;
119119
}) => {
120-
const response = await apiClient.get('/api/v1/expenses/personal/combined', {params});
120+
const response = await apiClient.get('/api/v2/expenses/personal/combined', {params});
121121
return response.data;
122122
},
123123

@@ -130,7 +130,7 @@ export const expenseAPI = {
130130
category?: string;
131131
search?: string;
132132
}) => {
133-
const response = await apiClient.get(`/api/v1/expenses/group/${groupId}/with-stats`, {params});
133+
const response = await apiClient.get(`/api/v2/expenses/group/${groupId}/with-stats`, {params});
134134
return response.data;
135135
},
136136

@@ -157,7 +157,7 @@ export const expenseAPI = {
157157
formData.append('receiptFile', data.receipt);
158158
}
159159

160-
const response = await apiClient.patch(`/api/v1/expenses/${id}`, formData, {
160+
const response = await apiClient.patch(`/api/v2/expenses/${id}`, formData, {
161161
headers: {
162162
'Content-Type': 'multipart/form-data'
163163
}
@@ -167,19 +167,19 @@ export const expenseAPI = {
167167

168168
// 지출 삭제
169169
delete: async (id: number) => {
170-
const response = await apiClient.delete(`/api/v1/expenses/${id}`);
170+
const response = await apiClient.delete(`/api/v2/expenses/${id}`);
171171
return response.data;
172172
},
173173

174174
// 영수증 URL 조회
175175
getReceiptUrl: async (id: number) => {
176-
const response = await apiClient.get(`/api/v1/expenses/${id}/receipt`);
176+
const response = await apiClient.get(`/api/v2/expenses/${id}/receipt`);
177177
return response.data;
178178
},
179179

180180
// 영수증만 삭제
181181
deleteReceipt: async (id: number) => {
182-
const response = await apiClient.delete(`/api/v1/expenses/${id}/receipt`);
182+
const response = await apiClient.delete(`/api/v2/expenses/${id}/receipt`);
183183
return response.data;
184184
},
185185

@@ -190,7 +190,7 @@ export const expenseAPI = {
190190
months?: number;
191191
category?: string;
192192
}) => {
193-
const response = await apiClient.get('/api/v1/expenses/personal/trend', { params });
193+
const response = await apiClient.get('/api/v2/expenses/personal/trend', { params });
194194
return response.data;
195195
},
196196

@@ -201,7 +201,7 @@ export const expenseAPI = {
201201
months?: number;
202202
category?: string;
203203
}) => {
204-
const response = await apiClient.get(`/api/v1/expenses/group/${groupId}/trend`, { params });
204+
const response = await apiClient.get(`/api/v2/expenses/group/${groupId}/trend`, { params });
205205
return response.data;
206206
},
207207

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/components/expenses/ExpenseModal.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ interface ExpenseModalProps {
1414
}
1515

1616
const ExpenseModal: React.FC<ExpenseModalProps> = ({expense, onClose}) => {
17+
// console.log('expense 객체: ', expense?.expenseType, expense);
18+
1719
const {addExpense, updateExpense, deleteExpense, mode, currentGroup} = useAppStore();
1820
const {user} = useAuthStore();
1921
const [isSubmitting, setIsSubmitting] = useState(false);
@@ -652,7 +654,7 @@ const ExpenseModal: React.FC<ExpenseModalProps> = ({expense, onClose}) => {
652654

653655
{/* Buttons */}
654656
<div className="flex space-x-3 pt-4">
655-
{expense && !expense.isGroupShare && (
657+
{expense && expense.expenseType !== 'SHARE' && (
656658
<motion.button
657659
type="button"
658660
className={`px-4 py-2 border border-red-300 text-red-700 rounded-lg font-medium transition-colors ${
@@ -677,7 +679,7 @@ const ExpenseModal: React.FC<ExpenseModalProps> = ({expense, onClose}) => {
677679
</motion.button>
678680
)}
679681

680-
{!expense?.isGroupShare && (
682+
{expense?.expenseType !== 'SHARE' && (
681683
<motion.button
682684
type="submit"
683685
className={`flex-1 px-4 py-2 bg-accent-500 text-white rounded-lg font-medium transition-colors ${

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)