-
Notifications
You must be signed in to change notification settings - Fork 79
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
[김혜선] sprint11 #684
The head ref may contain hidden characters: "Next.js-\uAE40\uD61C\uC120"
[김혜선] sprint11 #684
Conversation
}; | ||
}, [order, search, page]); | ||
|
||
const fetchBoard = async (order: string, search: string, page: number) => { |
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.
매개변수가 3개 이상 많아지면 객체로 관리하는게 편할 것 같아요.
const fetchedboard = await getBoardList({ | ||
page: 1, | ||
pageSize: 10000, | ||
page: page, |
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.
property shorthand 사용하면 좋을 것 같아요.
page: 1, | ||
pageSize: 10000, | ||
page: page, | ||
pageSize: 10, |
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.
기본적으로 정해진 사이즈가 있으면 함수 밖에 별도 상수로 작성하면 좋을 것 같아요.
@@ -12,6 +12,9 @@ export default function AddBoard() { | |||
|
|||
const titleErrMsg = document.querySelector(".titleEmpty"); | |||
const contentErrMsg = document.querySelector(".contentEmpty"); | |||
useEffect(() => { |
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.
document.title를 useEffect에 사용하지 마시고 app router이니 export const metadata로 하면 overwrite 될거에요.
@@ -24,12 +27,12 @@ export default function AddBoard() { | |||
} | |||
|
|||
//필수 값인 title과 content에 값이 있는지 확인 | |||
const title = formData.get("title"); | |||
const FormTitle = formData.get("title"); |
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.
파스칼 케이스로 하신 이유가 있을까요.
@@ -44,29 +44,10 @@ export async function validateAndRefreshTokens() { | |||
if (!accessToken || !refreshToken) { | |||
throw new Error("No tokens found"); | |||
} | |||
|
|||
const isTokenExpired = false; |
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.
false로 값을 고정시킨 이유가 있을까요.
}; | ||
|
||
const handleLogout = () => { | ||
localStorage.removeItem("accessToken"); |
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.
auth 관련 remove 하는 것은 여러 곳에서 사용될 수 있으므로 별도 함수로 재사용되게 만들면 좋을 것 같아요.
@@ -78,7 +78,7 @@ export default function AddBoard() { | |||
<label htmlFor="image" className={styles.imgTitle}> | |||
이미지 | |||
</label> | |||
<FileInput onChange={handleImageChange} /> | |||
<FileInput onChange={handleImageChange} image={null} /> |
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.
null 값을 넣으신 이유가 있을까요.
{...register("email", { | ||
required: "이메일을 입력해주세요", | ||
pattern: { | ||
value: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/, |
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.
정규식은 다른 곳에서도 사용할 수 있으므로 별도 상수로 관리하면 좋을 것 같아요.
@@ -53,7 +74,7 @@ export default function DetailBoard({ params }: { params: { id: string } }) { | |||
alt="profile" | |||
/> | |||
<p className={styles.nickname}>{boardData.writer.nickname}</p> | |||
<p className={styles.date}>{createdAt[0]}</p> | |||
<p className={styles.date}>{boardData.createdAt.split("T")[0]}</p> |
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.
date format 관련해서 별도로 util 함수 만들어서 재사용하면 좋을 것 같아요.
window.location.href = "/"; | ||
}; | ||
|
||
useEffect(() => { |
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.
위에서 useState 초깃값을 사전에 넣어서 이 코드는 불필요한 것 같아요.
import { usePathname } from "next/navigation"; | ||
|
||
export default function Header() { | ||
const [isToken, setIsToken] = useState<string | null>(); |
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.
현재 isToken 값이 비어있는데 초깃값으로 localStorage.getItem('accessToken') ?? null
이렇게 해주면 새로고침 시 깜빡임 없이 잘 나올 것 같아요.
기본
회원가입
스크린샷
로그인
스크린샷
메인
스크린샷
심화
멘토님께
로그인 관련 기능 작업 후 커밋을 한 줄 알았는데 헤더 커밋과 합쳐졌습니다.