Skip to content

Conversation

parkingun
Copy link

Sprint7 요구사항

기본

  • 각 상품 클릭 시 상품 상세 페이지로 이동합니다.
  • 상품 상세 페이지 주소는 “/items/{productId}” 입니다.
  • 상품 상세 페이지 주소는 “/items/{productId}” 입니다.
  • response 로 받은 아래의 데이터로 화면을 구현합니다
  • favoriteCount : 하트 개수
  • images : 상품 이미지
  • tags : 상품태그
  • name : 상품 이름
  • description : 상품 설명
  • 목록으로 돌아가기 버튼을 클릭하면 중고마켓 페이지 주소인 “/items” 으로 이동합니다
  • 문의하기에 내용을 입력하면 등록 버튼의 색상은 “3692FF”로 변합니다.
  • response 로 받은 아래의 데이터로 화면을 구현합니다
  • image : 작성자 이미지
  • nickname : 작성자 닉네임
  • content : 작성자가 남긴 문구
  • description : 상품 설명
  • updatedAt : 문의글 마지막 업데이트 시간

심화

  • [] 모든 버튼에 자유롭게 Hover효과를 적용하세요.

Sprint8 요구사항

기본

  • 스프린트 미션 5 ~ 7에 대해 typescript를 적용해주세요

심화

  • any타입을 최소한으로 써주세요

주요 변경사항

스크린샷

image

멘토에게

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

@parkingun parkingun requested a review from kich555 January 24, 2025 07:47
@parkingun parkingun added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Jan 24, 2025
@parkingun
Copy link
Author

아직 수정해야할 부분은 많습니다..ㅠ

Copy link
Collaborator

@kich555 kich555 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

accessToken: string;
};

export async function CreateCommentAPI({
Copy link
Collaborator

Choose a reason for hiding this comment

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

컴포넌트가 아닌데 이름이 파스칼케이스네요 카멜케이스로 바꿔주세요!

Copy link
Collaborator

Choose a reason for hiding this comment

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

함수의 반환타입도 명시해주면 좋을것 같아요

}: ProductParams) {
const response = await fetch(`${baseURL}/products/${productId}/comments`, {
method: "POST",
body: JSON.stringify({}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

body가 파라미터로 받는게 아니라 빈객체네요?

Comment on lines +3 to +13
export async function GetProductComments({ productId = 1 }) {
const response = await fetch(
`${baseURL}/products/${productId}/comments?limit=10`
);

if (!response.ok) {
throw new Error("코멘트 정보를 가져오는데 실패했습니다.");
}
const body = await response.json();
return body;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

try{}catch{} 구문을 사용해서 성공과 실패를 나눠서 처리하면 더 좋을것 같아요

Comment on lines +4 to +5
Email: string;
Password: string;
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 +5 to +6
const [email, setEmail] = useState<string>("");
const [password, setPassword] = useState<string>("");
Copy link
Collaborator

Choose a reason for hiding this comment

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

이건 하나의 객체 상태로 관리하는게 좀더 좋아보이네요 ㅎ

const [state, setState] = useState<{email:string, password:string}>({email:"",password:''});

Comment on lines +9 to +17
try {
const data = await SignInAPI({
Email: email,
Password: password,
});
console.log("response 확인: ", data);
} catch (error) {
console.error("로그인 실패: ", error); // 콘솔 로그로 에러를 출력
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기에 사용된 try catch구문은 SignInAPI 내부로 들어가야할 것 같아요

Comment on lines +13 to +18
const [productName, setProductName] = useState<string>();
const [productInfo, setProductInfo] = useState<string>();
const [productPrice, setProductPrice] = useState<string>();
const [productTag, setProductTag] = useState<string>("");
const [preview, setPreview] = useState<string | null>(null);
const [hashTags, setHashTags] = useState<HashTag[]>([]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

상태를 줄이는 연습을 해보면 좋습니다

@kich555 kich555 merged commit 1de512b into codeit-bootcamp-frontend:React-박인건 Feb 5, 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