Skip to content
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

Merged

Conversation

ohdong9795
Copy link
Collaborator

요구사항

기본

  • 로그인, 회원가입 페이지를 만들어 주세요.
  • 로그인 페이지의 url path는 ‘/signin’, 회원가입 페이지의 url path는 ‘/signup’ 입니다.

심화

  • 로그인, 회원가입 기능에 react-hook-form을 활용해 주세요.

주요 변경사항

  • signin, signup 페이지 추가

스크린샷

1
2
3

멘토에게

@ohdong9795 ohdong9795 requested a review from devToram May 19, 2024 12:18
Copy link
Collaborator

@devToram devToram left a 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;
}
Copy link
Collaborator

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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');
Copy link
Collaborator

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');
Copy link
Collaborator

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 = {...}

Comment on lines +54 to +82
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;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수가 state 를 쓰는 게 없다면 유틸함수로 빼주셔요!

@devToram devToram merged commit c1e342e into codeit-bootcamp-frontend:part3-오동혁 May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants