Skip to content

Conversation

@dlwnsl
Copy link
Collaborator

@dlwnsl dlwnsl commented Jan 10, 2025

요구사항

기본

중고마켓

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

상품 상세

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

상품 등록

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

심화

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

주요 변경사항

스크린샷

멘토에게

@dlwnsl dlwnsl requested a review from jyh0521 January 10, 2025 08:56
@dlwnsl dlwnsl self-assigned this Jan 10, 2025
@dlwnsl dlwnsl added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label 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.

고생하셨습니다!

const handleChange = (name: string, value: any) => {
setValues((initialValues) => ({
...initialValues,
setValues((prevState) => ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

좀 더 직관적인 이름으로 잘 수정해주셨네요~

Comment on lines +14 to +16
const [pageSize, setPageSize] = useState<number>(() =>
getPageSize("article")
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

useState 내부에 콜백 함수 잘 사용해주셨네요.

(error) => Promise.reject(error)
);

instance.interceptors.response.use(
Copy link
Collaborator

Choose a reason for hiding this comment

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

interceptor 기능을 잘 활용해주셨네요!


if (status === 401) {
// 로컬 스토리지에서 토큰 제거
localStorage.removeItem("accessToken");
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 +13 to +22
if (typeof window === "undefined") {
return context === "default" ? 3 : 10;
}

if (context === "item") {
if (width < 768) return 1;
if (width < 1280) return 2;
return 4;
}
const width = window.innerWidth;
const size = pageSize[context];

if (width < 768) return 4;
if (width < 1280) return 6;
return 10;
if (width < 768) return size.small;
if (width < 1280) return size.medium;
return size.large;
Copy link
Collaborator

Choose a reason for hiding this comment

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

상수를 잘 활용해서 코드가 많이 줄어든 것 같습니다.

Comment on lines +81 to +93

const formData = new FormData();
formData.append("name", values.name);
formData.append("favorite", values.favoriteCount.toString());
formData.append("description", values.description);
formData.append("price", values.price.toString());

if (values.images) {
values.images.forEach((image, index) => {
formData.append(`images[${index}]`, image);
});
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

개행 잘해주셔서 가독성이 더 좋아진 것 같습니다.

@jyh0521 jyh0521 merged commit fb2a0ca 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