-
Notifications
You must be signed in to change notification settings - Fork 117
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
[황경수] week16 #1065
The head ref may contain hidden characters: "part3-\uD669\uACBD\uC218-week16"
[황경수] week16 #1065
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
마지막 16주차 과제도 수고하셨습니다~
export const safeGetItem = (key: string) => { | ||
try { | ||
return localStorage.getItem(key); | ||
} catch (error) { | ||
console.error(error); | ||
return 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로 되어있는 경우에는 키에 대한 값이 없어서 null 일때와 에러가 발생해서 받은 값인 null 경우 구분하기가 어렵기 때문에, 해당 키 값이 없을땐 null / 에러 발생 시 undefined 이렇게 구분해서 리턴해주면 좋습니다~
}; | ||
|
||
export const passwordTextInputProps = (inputType: string) => ({ | ||
type: inputType, |
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.
여기서 inputType 값은 password 값이 일반적입니다~
@@ -0,0 +1,17 @@ | |||
export const emailTextInputProps = { | |||
type: "text", |
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.
여기서 inputType 값은 email 값이 더 일반적입니다.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
const accessToken = safeGetItem("accessToken"); | ||
if (accessToken !== null) setToken(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.
지난번 리뷰 사항을 잘 반영해주셨네요 👍
@@ -32,7 +34,7 @@ function SigninForm() { | |||
console.log(accessToken); | |||
|
|||
if (accessToken) { | |||
localStorage.setItem("accessToken", accessToken); | |||
saveToLocalStorage("accessToken", 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.
여기도 반영 굳! 👍
aa1f487
into
codeit-bootcamp-frontend:part3-황경수
요구사항
기본