Skip to content

Conversation

@hpk5802
Copy link
Collaborator

@hpk5802 hpk5802 commented Jan 10, 2025

요구사항

기본

중고마켓

  • '상품 등록하기' 버튼을 누르면 "/additem" 로 이동합니다.
  • 각 상품 클릭 시 상품 상세 페이지로 이동합니다.
  • 상품 상세 페이지 주소는 "/items/{productId}" 입니다.

상품 상세

  • 내가 등록한 상품일 경우 상품 수정, 삭제가 가능합니다.
  • 문의하기 input창에 값을 입력 후 '등록' 버튼을 누르면 댓글이 등록됩니다.
  • 내가 등록한 댓글은 수정, 삭제가 가능합니다.

상품 등록

  • 이미지를 제외하고 input 에 모든 값을 입력하면 '등록' 버튼이 활성화 됩니다.
  • 활성화된 '등록' 버튼을 누르면 상품 등록이 완료됩니다.
  • 등록이 완료되면 해당 상품 상세 페이지로 이동합니다.

심화

  • api 요청에 TanStack React Query를 활용해 주세요.

주요 변경사항

  • TanStack React Query 적용했습니다.
  • figma 상품 수정 화면이 없어 모달로 구현했습니다.

스크린샷

판다마켓

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

hpk5802 added 26 commits January 7, 2025 17:16
@hpk5802 hpk5802 requested a review from jyh0521 January 10, 2025 00:53
@hpk5802 hpk5802 self-assigned this Jan 10, 2025
@hpk5802 hpk5802 added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Jan 10, 2025
@hpk5802 hpk5802 changed the title Next 강수민 sprint12 [강수민] Sprint12 Jan 10, 2025
Copy link
Collaborator

@jyh0521 jyh0521 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

Comment on lines 61 to +62
const imgUrl = files[0];
const imgPath = URL.createObjectURL(imgUrl);
setImg(imgPath);
setImg(imgUrl);
Copy link
Collaborator

Choose a reason for hiding this comment

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

imgUrl을 사용하는 곳이 한 군데 뿐이라면 따로 변수를 만들지 않고 setImg(files[0]) 이런식으로 작성하셔도 됩니다.

Comment on lines 22 to +24
localStorage.removeItem("accessToken");
localStorage.removeItem("refreshToken");
localStorage.removeItem("userId");
Copy link
Collaborator

Choose a reason for hiding this comment

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

localStorage의 키 값들도 상수로 관리해주셔도 좋습니다.

Comment on lines +64 to +68
images: u_images,
name: u_name,
description: u_description,
price: u_price,
tags: u_tags,
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도 카멜 케이스 그대로 활용해주셔도 괜찮습니다. uImages, uName 이런식으로요!

</div>
</div>
</div>
<Modal isOpen={isOpen} closeModal={handleCloseModal}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

모달 컴포넌트 내부의 코드가 은근히 길어져서 따로 컴포넌트로 만드셔서 사용해주셔도 좋습니다.


interface DropDownInquiryProps {
setIsEditting: (value: boolean) => void;
onDelete: () => void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

setState 하는 함수 대신 handler 함수를 받아오게 하신 점 좋네요~ 더 유연하게 사용할 수 있을 것 같습니다.

const { data } = useQuery({
queryKey: ["products", currentPage, productsPerPage, order, keyword],
queryFn: () =>
fetchProducts({
Copy link
Collaborator

Choose a reason for hiding this comment

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

fetchProducts 함수를 사용하는 useQuery가 또 있는 것 같은데, 두 경우 모두 사용할 수 있는 훅을 만들어보는 것은 어떨까요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

모달 컴포넌트 잘 만들어주셨네요!

// 추후 POST API 연동 예정
// console.log(e);
postProduct({ content: userInput });
const { id } = await postProduct({ content: userInput });
Copy link
Collaborator

Choose a reason for hiding this comment

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

post 하는 함수는 useMutation 함수를 활용해보시면 어떨까요?

Comment on lines +147 to +148
onUpdate={() => {}}
onDelete={() => {}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

아직 handler 함수가 개발되지 않은 것이라면 괜찮지만, 그게 아니라 만약 빈 함수를 넣어야 하는 상황이라면 해당 컴포넌트의 핸들러 함수들을 nullable하게 타입 지정해주시는 것도 좋을 것 같습니다.

@jyh0521 jyh0521 merged commit b102cee into codeit-bootcamp-frontend:Next-강수민 Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants