-
Notifications
You must be signed in to change notification settings - Fork 46
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 #450
The head ref may contain hidden characters: "part3-\uC624\uB3D9\uD601"
[오동혁] Week14 #450
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.
수고하셨습니다:)
onBlur?: (param: SyntheticEvent) => void; | ||
onChange?: (param: SyntheticEvent) => void; | ||
hasError?: boolean; | ||
type?: 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.
기존 Input 태그를 감싸는 방식으로 Props 를 가져오고 싶으시다면 React.InputHTMLAttributes<HTMLInputElement>
를 사용해보셔도 좋을 거 같아요!
// }, []) | ||
|
||
useEffect(() => { | ||
if (loading !== true && error === 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.
if (loading !== true && error === null) { | |
if (!loading && error === null) { |
if (loading !== true && error === null) { | ||
if (data.data) { | ||
localStorage.accessToken = data.data.accessToken; | ||
router.push('folder'); |
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.
확실하게 early return 적어주시는 걸 추천드려요!
}, [data, loading, error]); | ||
|
||
const handleEyeClick = () => { | ||
setPwType(pwType === 'password' ? 'text' : '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.
pwType 을 enum 타입으로 정하고 쓰면 좋을 거 같습니다!
enum PW_TYPE = {...}
const checkDuplicate = async (value: string) => { | ||
try { | ||
const res = await fetch(baseUrl + endpoints.checkEmail.url, { | ||
method: endpoints.checkEmail.method, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
email: value.toString(), | ||
}), | ||
}); | ||
|
||
if (res.status === 200) { | ||
return true; | ||
} | ||
|
||
if (res.status === 409) { | ||
return '이미 사용 중인 이메일입니다.'; | ||
} | ||
} catch (error: unknown) { | ||
if (error instanceof Error) { | ||
return error.message; | ||
} else { | ||
return 'Unexpected error'; | ||
} | ||
} | ||
|
||
return true; | ||
}; |
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.
함수가 state 를 쓰는 게 없다면 유틸함수로 빼주셔요!
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게