-
Notifications
You must be signed in to change notification settings - Fork 37
[김찬기] Sprint 11 #314
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
[김찬기] Sprint 11 #314
The head ref may contain hidden characters: "Next-\uAE40\uCC2C\uAE30-sprint11"
Conversation
- Record이용
- 중복관리를 set을 사용해보기
- 공식문서 nextjs 예제 참고
- server action에서 interceptor가 동작하지 않아서 수정
- 이미지를 유저정보를 조회해서 가져오도록 변경(프로필 이미지 변경시 재조회 가능하도록)
- 서버와 클라이언트에서 함께 쓰도록 개선
- (방법1) session provider에 key 설정 (선택) - (방법2) 서버액션 종료후 useSession의 update호출
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전반적으로 너무 잘 해주셨는데요...ㅋㅋㅋ
코멘트 남긴것도 사소해서... 사실 그냥 넘어가도 문제없는 내용들이라...ㅎㅎ
고생 많으셨습니다!!
<Form | ||
isLoading={isSubmitting} | ||
error={formError} | ||
onSubmit={handleSubmit(onSubmit)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오.... Form 공통화를 이렇게 해두니 사용하기 편하게 잘 하셨네요ㅎㅎ!
interface ArticleAddFormProps { | ||
mode: "add"; | ||
onFormSubmit: (data: ArticleFormType) => Promise<Article | undefined>; | ||
} | ||
interface ArticleModifyFormProps { | ||
initialData: Article; | ||
mode: "edit"; | ||
onFormSubmit: (data: ArticleFormType) => Promise<Article | undefined>; | ||
} | ||
|
||
type ArticleFormProps = ArticleAddFormProps | ArticleModifyFormProps; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
타입스크립트가 잘 추론해서 사용할 수 있도록 해주셨네요ㅎㅎ!
<div className={styles.info}> | ||
<h2 className={styles.name}>{nickname}</h2> | ||
<div className={styles.date}> | ||
가입일 : {dayjs(createdAt).format("YYYY-MM-DD")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createdAt가 알수없는 문자열이나 dayjs가 파싱하지 못하는 값이 오는걸 대비해서 예외처리해주면 좀더 좋을것같네요!
const createdDay = dayjs(createdAt)
return (
...
가입일: {createdDay.isValid() ? createdDay.format("YYYY-MM-DD") : "-"}
...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전에 이 부분 코드리뷰해주셔서, 날짜검증후에 포맷팅하는 유틸함수를 만들어 두었는데 사용안하고 그냥 써버렸네요... 수정해두겠습니다!
}; | ||
} catch (error) { | ||
if (isAxiosError(error)) { | ||
console.log(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error 인 경우엔 console.error 가 좀더 좋을것같아요ㅎㅎ
const session = await auth(); | ||
if (!session) { | ||
redirect("/login"); | ||
} | ||
|
||
const { nickname, image } = await getUser(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getUser 에서 값을 정상적으로 가져오지 못한경우에도 login 페이지로 redirect 시켜주면 좀더 좋을것같아요
<Dropdown.Item onClick={() => router.push("/mypage")}> | ||
내정보 | ||
</Dropdown.Item> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
router로 이동하는것보단 Link를 사용하는게 좀더 좋긴 해요ㅎㅎ
onClick으로 하면 prefetch도 안되기도 하고, 브라우저 스팩에 따라서 휠클릭도 안먹을 수 있어서요ㅠ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
드롭다운을 버튼으로 만들어두어서 버튼으로 해결했는데, 이번 기회에 원하는 엘레멘트로 설정할 수 있게 수정하겠습니다. ㅎㅎ
export const COMMENT_EMPTY: Record< | ||
BoardName, | ||
{ image: string; message: string } | ||
> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
타입처리 👍
const session = | ||
typeof window === "undefined" ? await auth() : await getSession(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엇? 이렇게 되어있으면 axios로 요청 날릴떄마다 auth정보나 session 정보를 가져오지 않나요...?
차라리 메모리에 들고있다가 있으면 있는거 쓰고, 없을떄 가져오게 처리하면 어떨까요??
요구사항
기본
회원가입
로그인
메인
주요 변경사항
스크린샷
멘토에게