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

[손재헌] sprint10 #288

Conversation

Jaeheon96
Copy link
Collaborator

@Jaeheon96 Jaeheon96 commented Aug 15, 2024

요구사항

기본

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

심화

  • 회원가입, 로그인 api를 사용하여 받은 accessToken을 사용하여 게시물 등록을 합니다.

주요 변경사항

  • 액세스 토큰으로 api 접근 권한은 얻었는데 이미지 업로드는 어떻게 하는지 감이 안잡혀 구현을 못했습니다.
  • 회원가입과 리프레시 토큰으로 액세스 토큰 갱신은 구현하지 못했습니다.

스크린샷

sprint10_1
sprint10_2
sprint10_3
sprint10_4

멘토에게

  • 백엔드 api 명세에 이미지 업로드는 string($binary)로 하면 된다고 돼있는데 어떤 형식으로 넣어야 하나요? 인풋의 value인 파일 경로, input.files[0]에 저장된 File, URL.createObjectUrl로 만든 url로 시도해봤는데 셋 다 500 에러 받았습니다..
  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

@Jaeheon96 Jaeheon96 requested a review from jyh0521 August 15, 2024 16:07
@Jaeheon96 Jaeheon96 self-assigned this Aug 15, 2024
@Jaeheon96 Jaeheon96 added 매운맛🔥 뒤는 없습니다. 그냥 필터 없이 말해주세요. 책임은 제가 집니다. 미완성🫠 죄송합니다.. labels Aug 15, 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.

과제하느라 고생하셨습니다!

Comment on lines +1 to +5
export default interface ArticlePost {
image: string;
content: string;
title: string;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

post의 body 타입은 보통 PostArticleBody 같은 이름도 추천드려요

Comment on lines +6 to +10
writer: {
id: number;
nickname: string;
image: string;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

writer 타입도 있어도 좋아보입니다.

@@ -0,0 +1,11 @@
export default interface CommentType {
Copy link
Collaborator

Choose a reason for hiding this comment

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

타입 정렬해서 작성해주신거 좋네요!

<div className={styles.articleWriter}>
<div className={styles.profileImageContainer}>
<Image fill src="/images/ic_profile.png" alt="프로필" />
<Link href={`boards/${article.id}`} style={{ textDecoration: "none"}}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Link 잘 활용해주셨네요!

@@ -64,4 +64,24 @@
}
}
}

.loginButton {
Copy link
Collaborator

Choose a reason for hiding this comment

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

css 옵션 관련있는것끼리 깔끔하게 잘 정리해주셨네요!

const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [isDropdownClicked, setIsDropdownClicked] = useState(false);
const [isDocumentClicked, setIsDocumentClicked] = useState(false);
const [dropdownState, setDropdownState] = useState(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 상태를 숫자로 관리해주셨는데, 혹시 어떤 의미일까요?

nextCursor: number | null;
}

export const getServerSideProps: GetServerSideProps = async (context) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

getServerSideProps 활용 잘해주셨네요!

Comment on lines +24 to +31
let article: ArticleType;
try {
article = await getArticle(id);
} catch {
return {
notFound: true
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 로직은 어차피 해당 id에 해당하는 데이터를 불러오지 않는다면 다른 값들이 null일 것이기 때문에 그것들로 예외처리를 해보시는 것도 괜찮을 것 같습니다.

@jyh0521
Copy link
Collaborator

jyh0521 commented Aug 19, 2024

질문은 멘토링 시간에 같이 보면 좋을 것 같습니다.

@jyh0521 jyh0521 merged commit 7733b43 into codeit-bootcamp-frontend:Next-손재헌 Aug 19, 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