-
Notifications
You must be signed in to change notification settings - Fork 0
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: 리뷰 등록 step 1,2,3 페이지 구현 #162
base: develop
Are you sure you want to change the base?
Conversation
fff49ea
to
62e7ef9
Compare
const { mutateAsync: createReviewMutation } = useMutation(postReview); | ||
const { mutateAsync: createReviewMutation } = useMutation(createReview); |
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.
mutation도 한 번 래핑해서 사용하는건 어떠신가요?
export const useCreateReviewMutation = () => {
const cache = useQueryClient();
const { mutateAsync: createReviewMutation, ...rest } = useMutation(createReview, {
onSuccess: async () => {
await cache.invalidateQueries(queryKeyFactory.GET_REVIEW);
},
});
return {
createReview: createReviewMutation,
...rest,
};
};
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.
useGetReviewsByBeer
도 queryKey를 queryKeyFactory에서 가져오는 방식으로 변경하는거 어떨까요!?
ref
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.
src/apis/review/createReview.ts
Outdated
|
||
const { mutateAsync: createReviewMutation, ...rest } = useMutation(createReview, { | ||
onSuccess: async () => { | ||
await cache.invalidateQueries(queryKeyFactory.CREATE_REVIEW()); |
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.
리뷰 생성되고 호출되는 success 함수 내부에서는 리뷰 리스트를 invalidate 시켜야하지 않나요..?
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.
아핫..! 리뷰 리스트를 invalidate 하는 것으로 수정했습니다. 리뷰 감사합니다 🫢
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.
commnet만 확인 부탁드립니다. 나머지는 LGTM!
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.
고생하셨슴다 👍👍
@@ -97,12 +97,12 @@ const BeerTicketTitle: React.FC<BeerTicketTitleProps> = ({ | |||
{sliceAndUpperCase(beer?.country?.engName || 'non', 3)} | |||
</span> | |||
<div className="ticket-detail"> | |||
{`${beer?.alcohol?.toFixed(1)}%`} | |||
{beer?.alcohol ? `${beer.alcohol?.toFixed(1)}%` : '-'} |
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.
'?' 없어도 괜찮을 것 같아요!
{beer?.alcohol ? `${beer.alcohol?.toFixed(1)}%` : '-'} | |
{beer?.alcohol ? `${beer.alcohol.toFixed(1)}%` : '-'} |
📍 주요 변경사항
🔗 참고자료
💡 중점적으로 봐주었으면 하는 부분