-
Notifications
You must be signed in to change notification settings - Fork 57
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
[박준성] Week14 #426
The head ref may contain hidden characters: "part3-\uBC15\uC900\uC131-week14"
[박준성] Week14 #426
Conversation
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.
고생하셨습니다. 곧 프로젝트 시작인데 화이팅하시고 질문사항 생기면 언제든지 알려주세요!
<span className={styles.ErrorMessage}>{errors?.email?.message}</span> | ||
{!!errors.email && ( | ||
<span className={styles.ErrorMessage}> | ||
{errors?.email?.message} |
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.
잘 수정해주셨네요! 큰 부분은 아니지만 굳이 따지자면, 47행에서 이미 email
객체가 있을 때만 49행이 렌더링 되기 때문에 errors.email
은 항상 존재합니다. 따라서 errors?.email?.message
가 아닌 errors.email.message
로 적어도 됩니다!
@@ -4,7 +4,7 @@ import { errorMessages, emailRegex, passwordRegex } from "../utils/regexp"; | |||
import { signIn } from "../lib/loginApi"; | |||
import Image from "next/image"; | |||
import styles from "../styles/Sign.module.css"; | |||
import LogoTitle from "../components/signPage/LogoTitle"; | |||
import LogoTitle from "../components/elements/LogoTitle"; |
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.
elements
란 디렉토리 이름의 정확한 의미가 무엇인가요? 😅
|
||
export async function signIn(email, password, setError) { | ||
try { | ||
const res = await axios.post(`${baseURL}/sign-in`, { | ||
const res = await instance('/sign-in', { |
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.
이것도 큰 부분은 아니지만, instance
보다는 httpRequestInstance
, axiosInstance
등의 명확한 이름이 더 좋아보입니다!
|
||
export async function signIn(email, password, setError) { | ||
try { | ||
const res = await axios.post(`${baseURL}/sign-in`, { | ||
const res = await instance('/sign-in', { |
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.
추후 어플리케이션이 더 커지게 될 때에는, /sign-in
같은 엔드포인트들도 상수로 처리할 수 있습니다.
@@ -25,7 +23,7 @@ export async function signIn(email, password, setError) { | |||
|
|||
export async function signUp(email, password) { | |||
try { | |||
const res = await axios.post(`${baseURL}/sign-up`, { email, password }); | |||
const res = await instance('/sign-up', { email, password }); |
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.
아래 27행에서 if (res.status === 200)
을 수행하지 않아도 됩니다. 이미 try-catch
문 안에 있기 때문에, 200번대가 아닌 응답 오류(400번대 이상)이 뜬다면 저절로 catch
블록으로 이동할 것이고 문제 없이 결과값을 받았으면(여기서는 200번 응답) 그냥 계속 실행될 것이기 때문입니다. 특히, 200번대에는 200번 응답 말고도 203등도 자주 사용되기 때문에 이에 대한 것도 생각해보시면 좋을 것 같습니다.
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게