Skip to content
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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

hy57in
Copy link
Contributor

@hy57in hy57in commented Feb 12, 2023

📍 주요 변경사항

  • API 필드가 review로 되어 있어서 record -> review로 네이밍을 변경했습니다
  • API 가 호출되지 않아 mock data로 UI 확인하며 작업하였고 API 연동되면 mock data 부분 지울 예정입니다

image

🔗 참고자료

💡 중점적으로 봐주었으면 하는 부분

@hy57in hy57in self-assigned this Feb 12, 2023
const { mutateAsync: createReviewMutation } = useMutation(postReview);
const { mutateAsync: createReviewMutation } = useMutation(createReview);
Copy link
Contributor

@hoo00nn hoo00nn Feb 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hy57in

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,
  };
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hy57in

useGetReviewsByBeer 도 queryKey를 queryKeyFactory에서 가져오는 방식으로 변경하는거 어떨까요!?

ref

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bf34ee2

만들어두신 queryKeyFactory 를 잊고 있었네요. 해당부분 수정했습니다!

mutaion도 래핑해서 수정했습니다!

@hy57in hy57in requested a review from hoo00nn February 12, 2023 12:42
@hy57in hy57in linked an issue Feb 12, 2023 that may be closed by this pull request

const { mutateAsync: createReviewMutation, ...rest } = useMutation(createReview, {
onSuccess: async () => {
await cache.invalidateQueries(queryKeyFactory.CREATE_REVIEW());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hy57in

리뷰 생성되고 호출되는 success 함수 내부에서는 리뷰 리스트를 invalidate 시켜야하지 않나요..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아핫..! 리뷰 리스트를 invalidate 하는 것으로 수정했습니다. 리뷰 감사합니다 🫢

Copy link
Contributor

@hoo00nn hoo00nn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commnet만 확인 부탁드립니다. 나머지는 LGTM!

Copy link
Contributor

@syoung125 syoung125 left a 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)}%` : '-'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'?' 없어도 괜찮을 것 같아요!

Suggested change
{beer?.alcohol ? `${beer.alcohol?.toFixed(1)}%` : '-'}
{beer?.alcohol ? `${beer.alcohol.toFixed(1)}%` : '-'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

리뷰 등록 페이지 구현
3 participants