Skip to content

Commit

Permalink
chore: 코드리뷰 반영하여 END POINT 깔끔하게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
zzz-myam committed Jan 22, 2025
1 parent 8ca7692 commit 6381815
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/apis/likes/useDeleteCakeLikes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MutateResposneType } from '@types';

const deleteCakeLikes = async (cakeId: number): Promise<MutateResposneType> => {
try {
const response = await instance.delete(END_POINT.DELETE_CAKE_LIKES(cakeId));
const response = await instance.delete(END_POINT.DELETE_LIKE('cake', cakeId));
return response.data;
} catch (error) {
console.log(error);
Expand Down
4 changes: 1 addition & 3 deletions src/apis/likes/useDeleteStoreLikes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ const deleteStoreLikes = async (
storeId: number
): Promise<MutateResposneType> => {
try {
const response = await instance.delete(
END_POINT.DELETE_STORE_LIKES(storeId)
);
const response = await instance.delete(END_POINT.DELETE_LIKE('store', storeId));
return response.data;
} catch (error) {
console.log(error);
Expand Down
2 changes: 1 addition & 1 deletion src/apis/likes/usePostCakeLikes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MutateResposneType } from '@types';

const postCakeLikes = async (cakeId: number): Promise<MutateResposneType> => {
try {
const response = await instance.post(END_POINT.POST_CAKE_LIKES(cakeId));
const response = await instance.post(END_POINT.DELETE_LIKE('cake', cakeId));
return response.data;
} catch (error) {
console.log(error);
Expand Down
2 changes: 1 addition & 1 deletion src/apis/likes/usePostStoreLikes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MutateResposneType } from '@types';

const postStoreLikes = async (storeId: number): Promise<MutateResposneType> => {
try {
const response = await instance.post(END_POINT.POST_STORE_LIKES(storeId));
const response = await instance.post(END_POINT.POST_LIKE('store', storeId));
return response.data;
} catch (error) {
console.log(error);
Expand Down
12 changes: 8 additions & 4 deletions src/constants/apis/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ export const END_POINT = {
FETCH_STORE_LINK: (storeId: number) => `/api/v1/store/kakaoLink/${storeId}`,
FETCH_USER: '/api/v1/user',
FETCH_CAKE_RANK: '/api/v1/cake/rank',
POST_CAKE_LIKES: (cakeId: number) => `/api/v1/cake/likes/${cakeId}`,
POST_STORE_LIKES: (storeId: number) => `/api/v1/store/likes/${storeId}`,
DELETE_CAKE_LIKES: (cakeId: number) => `/api/v1/cake/likes/${cakeId}`,
DELETE_STORE_LIKES: (storeId: number) => `/api/v1/store/likes/${storeId}`
// POST_CAKE_LIKES: (cakeId: number) => `/api/v1/cake/likes/${cakeId}`,
// POST_STORE_LIKES: (storeId: number) => `/api/v1/store/likes/${storeId}`,
// DELETE_CAKE_LIKES: (cakeId: number) => `/api/v1/cake/likes/${cakeId}`,
// DELETE_STORE_LIKES: (storeId: number) => `/api/v1/store/likes/${storeId}`
POST_LIKE: (type: 'cake' | 'store', id: number) =>
`/api/v1/${type}/likes/${id}`,
DELETE_LIKE: (type: 'cake' | 'store', id: number) =>
`/api/v1/${type}/likes/${id}`,
} as const;

0 comments on commit 6381815

Please sign in to comment.