-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat/#165] 스토어 찜 취소 / 디자인 찜 취소 API 연결 #167
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
102fff9
feat: api 연결 준비
zzz-myam 3ca0d04
feat: api 연결 중, 낙관적 업데이트 필요함
zzz-myam 8de172e
feat: api 연결 중
zzz-myam 29de348
chore: git merge develop
zzz-myam 2a51a4b
feat: api 연결 성공
zzz-myam a63f97c
chore: index.ts 수정
zzz-myam 8ca7692
setting: git merge develop
zzz-myam 6381815
chore: 코드리뷰 반영하여 END POINT 깔끔하게 수정
zzz-myam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
import { usePostStoreLikes } from './usePostStoreLikes'; | ||
import { useDeleteCakeLikes } from './useDeleteCakeLikes'; | ||
import { useDeleteStoreLikes } from './useDeleteStoreLikes'; | ||
import { usePostCakeLikes } from './usePostCakeLikes'; | ||
import { usePostStoreLikes } from './usePostStoreLikes'; | ||
|
||
export { usePostStoreLikes, usePostCakeLikes }; | ||
export { | ||
usePostStoreLikes, | ||
usePostCakeLikes, | ||
useDeleteCakeLikes, | ||
useDeleteStoreLikes, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
import { instance } from '@apis/instance'; | ||
|
||
import { END_POINT } from '@constants'; | ||
|
||
import { MutateResposneType } from '@types'; | ||
|
||
const deleteCakeLikes = async (cakeId: number): Promise<MutateResposneType> => { | ||
try { | ||
const response = await instance.delete(END_POINT.DELETE_CAKE_LIKES(cakeId)); | ||
return response.data; | ||
} catch (error) { | ||
console.log(error); | ||
throw error; | ||
} | ||
}; | ||
|
||
export const useDeleteCakeLikes = () => { | ||
return useMutation({ | ||
mutationFn: (cakeId: number) => deleteCakeLikes(cakeId), | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
|
||
import { instance } from '@apis/instance'; | ||
|
||
import { END_POINT } from '@constants'; | ||
|
||
import { MutateResposneType } from '@types'; | ||
|
||
const deleteStoreLikes = async ( | ||
storeId: number | ||
): Promise<MutateResposneType> => { | ||
try { | ||
const response = await instance.delete( | ||
END_POINT.DELETE_STORE_LIKES(storeId) | ||
); | ||
return response.data; | ||
} catch (error) { | ||
console.log(error); | ||
throw error; | ||
} | ||
}; | ||
|
||
export const useDeleteStoreLikes = () => { | ||
return useMutation({ | ||
mutationFn: (storeId: number) => deleteStoreLikes(storeId), | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 URL에서 cake와 store만 달라지는 것 같은데 혹시 번거롭지 않다면 찜 API 하나, 찜 삭제 API 하나로 통합해보는 건 어떨까요..?
간단한 예시긴 하지만 이런 식으로 통합해볼 수.. 있을 것 같아요! 물론 리팩토링 때 고려해봐도 좋긴 합니다:)