Skip to content

Conversation

@whdjh
Copy link
Collaborator

@whdjh whdjh commented Dec 7, 2024

요구사항

체크리스트 [기본]

상품 등록 페이지
[x] 상품 등록 페이지 주소는 "/addboard" 입니다.
[x] 게시판 이미지는 최대 한개 업로드가 가능합니다.
[x] 각 input의 placeholder 값을 정확히 입력해주세요.
[x] 이미지를 제외하고 input 에 모든 값을 입력하면 '등록' 버튼이 활성화 됩니다.
상품 상세 페이지
[x] 상품 상세 페이지 주소는 "/board/{id}" 입니다.
[x] 댓글 input 값을 입력하면 '등록' 버튼이 활성화 됩니다.
[x] 활성화된 '등록' 버튼을 누르면 댓글이 등록됩니다

체크리스트 [심화]

상품 등록 페이지
[] 회원가입, 로그인 api를 사용하여 받은accessToken을 사용하여 게시물 등록을 합니다.
[] ’등록' 버튼을 누르면 게시물 상세 페이지로 이동합니다.

주요 변경사항

  • sprint10적용

스크린샷

스크린샷 2024-12-07 오후 9 52 56 스크린샷 2024-12-07 오후 9 53 17

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.
  • 코멘트 사항은 다음주에 sprint9,10 함께 적용하도록 하겠습니다.

@whdjh whdjh requested a review from jyh0521 December 9, 2024 05:42
@whdjh whdjh added the 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. label Dec 9, 2024
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.

고생하셨습니다.

@@ -0,0 +1,32 @@
export async function getArticleDetail(articleId: number) {
try {
const response = await fetch(`https://panda-market-api.vercel.app/articles/${articleId}`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

도메인 주소는 .env로 따로 관리해주셔도 좋을 것 같습니다.

}

export async function getArticleComment({ articleId, limit = 10, }: { articleId: number; limit?: number;}) {
const params = { limit: String(limit), };
Copy link
Collaborator

Choose a reason for hiding this comment

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

query가 string으로 변환되기 때문에 String으로 변환하지 않으셔도 될 것 같은데, 에러가 발생하지 않는다면 String은 빼주셔도 될 것 같습니다.

@@ -0,0 +1,17 @@
import { format, differenceInDays, differenceInHours, differenceInMinutes, differenceInSeconds, } from "date-fns";

export const TimestampCal = (dateString: Date) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 컴포넌트는 문자열만 반환해주는데, 이럴때는 컴포넌트 보다는 함수로 사용하셔도 좋습니다.

type?: string;
}

const InputItem: React.FC<InputItemProps> = ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

내부에 textarea와 input 컴포넌트가 각각 존재하기 때문에 이런 경우에는 두 컴포넌트로 분리해주시는 것도 좋습니다.


const ArticleCommentThread: React.FC<ArticleCommentThreadProps> = ({ articleId }) => {
const [comment, setComment] = useState<Comment[]>([]);
const [error, setError] = useState<string | null>(null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

에러가 없을때 빈 문자열이 아니라 null로 명시해주신거 좋네요.


async function fetchArticle() {
if(!articleId) {
setError('아이디없음');
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 5da4762 into codeit-bootcamp-frontend:Next-이주훈 Dec 9, 2024
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