-
Notifications
You must be signed in to change notification settings - Fork 6
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
[FE] 회원가입시 예외처리를 하고, 한줄평 글자 1칸초과하는것을 해결한다. #1040
Conversation
@@ -53,6 +54,10 @@ const SubmitModalWithSummary = ({ | |||
onError(); | |||
}; | |||
|
|||
const handleChange = (e: ChangeEvent<HTMLInputElement>) => { | |||
if (e.target.value.length <= 15) summary.onChange(e); |
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.
이건 상수화를 하면 좋을 것 같습니다!
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.
네
frontend/src/pages/SignUpPage.tsx
Outdated
@@ -60,16 +60,11 @@ const SignUpPage = () => { | |||
|
|||
const disabled = !isEmailValidated || !isNameValidated || !isPasswordValidated || !isPasswordConfirmValidated; | |||
|
|||
const mutation = usePostSignUpQuery(); | |||
if (mutation.isSuccess) navigate(ROUTE_PATH.signIn); |
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.
실패시 postErrorMessage 가 떠서 에러 메세지가 렌더링 되게 해주어야 하는데 (로그인과 회원가입 실패는 toast 를 쓰지 않습니다) 이 로직도 포함시켜야 할 것 같습니다! 이렇게 되면 사용자가 회원가입을 실패한 이유를 알 수 없을 것 같아요..
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.
에러 시 토스트 떠요
(react-query 디폴트로 onError시 토스트 뜨게 되어서그래요)
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.
맞습니다ㄹ
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.
리안과 대화결과
토스트보다는 render로 보여주는 게 좋을거같다고 하여,
방법을찾아보고 적용했습니다.
해결한문제 : 디폴트로 들어간 onError를 특정 mutation에대해서만 해제하기
const client = useQueryClient();
client.setMutationDefaults(['auth', 'sign-up'], { onError: undefined });
를 통해 특정쿼리에 대해서만 onError를 해제할수있었습니다.
로그인 로직인데 참고하시면 좋을 것 같습니다! const handleSubmit = async () =>
await signIn(
{ email, password },
{
onSuccess: async () => {
const result = await getUserInfo();
init(result.userEmail);
showToast({ message: `${result?.userName}님, 환영합니다.`, type: 'confirm' });
return navigate(ROUTE_PATH.home);
},
onError: error => setPostErrorMessage(error.message), //이부분
},
); |
frontend/src/pages/SignUpPage.tsx
Outdated
@@ -60,16 +60,11 @@ const SignUpPage = () => { | |||
|
|||
const disabled = !isEmailValidated || !isNameValidated || !isPasswordValidated || !isPasswordConfirmValidated; | |||
|
|||
const mutation = usePostSignUpQuery(); | |||
if (mutation.isSuccess) navigate(ROUTE_PATH.signIn); |
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.
맞습니다ㄹ
frontend/src/pages/SignUpPage.tsx
Outdated
await mutation.mutate({ name, email, password }); | ||
showToast({ message: '회원가입이 완료되었습니다.', type: 'confirm' }); |
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.
이부분 구조분해 + 쿼리 내부로 로직 넣는건 어떨까요?
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.
넣었습니다 !
…ng-ggood into fix/1032-sign-up
|
||
const usePostSignUpQuery = () => { | ||
const client = useQueryClient(); | ||
client.setMutationDefaults(['auth', 'sign-up'], { onError: undefined }); |
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.
👍👍👍
❗ Issue
✨ 구현한 기능
회원가입시 예외처리
한줄평 글자 1칸초과하는것을 해결한다.
📢 논의하고 싶은 내용
🎸 기타