-
Notifications
You must be signed in to change notification settings - Fork 5
[feat, refactor] #177 ResetPasswordModal, OpenPasswordModal, Modal.tsx, useModalStore: 비밀번호 재설정 모달 구현 / Modal, useModalStore: form 제출 기능 확장 및 IIFE 지원 / 상태 구독 기반 API 호출 처리 #192
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
Conversation
- 요청 성공시 toast.success 및 closeModal 호출 - 요청 실패 시 toast.error 로 사용자 알림 추가 - 에러 로그 메시지를 한글로 명확히 출력
|
✅ Preview Deployment |
|
✅ Preview Deployment |
|
✅ Preview Deployment |
|
✅ Preview Deployment |
ARON-Y
left a comment
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.
수고하셨습니다 해명님!😎
- 기존 방법 사용 시, onClick 후 모달이 닫혀 onSubmit 이벤트가 실행되지 않는 이슈 - <form> 요소 존재 시, 직접 submit 이벤트를 트리거하도록 확장
- openPasswordResetModal 에서 subscribe 사용을 위한 미들웨어 적용
- form 태그 내부에서 직접 유효성 검사 및 requestBody 설정, 모달 닫힘 기능 구현 - 외부 콜백 onRequest 로직을 내부에서 처리 (기존 onClick 과 onSubmit 과의 타이밍 이슈 해결) - useModalStore 의 subscribe 기반 API 호출 구조와 연동
|
✅ Preview Deployment |
| button?.onRequest?.(requestBody); | ||
| closeModal(); | ||
| isSubmittedRef.current = false; | ||
| console.log('handleRequest 실행'); |
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.
이 부분은 디버깅을 위한 console.log일까요?? 그렇다면 나중에 지워주시면 좋을 것 같습니다!
| const isModalOpen = Boolean(title || content); | ||
|
|
||
| // 폼 제출 시도 여부를 추적하는 플래그 | ||
| const isSubmittedRef = useRef(false); |
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.
수정 이후 <form> 태그에서도 해당 ref 는 사용하고 있지 않은 상황이라, 추후 삭제해도 괜찮을 것 같습니다 ~!
| toast.error('존재하지 않는 이메일입니다. 회원가입을 먼저 해주세요.'); | ||
| router.push('/signup'); |
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.
의견 감사합니다! 다음 PR에서 반영하겠습니다 ~!
| number: 2, | ||
| text: '링크 보내기', | ||
| // 기존 모달 컴포넌트의 onRequest 호출 방식과의 일관성을 위해 빈 함수 전달 | ||
| onRequest: () => {}, |
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.
이번에 모달 컴포넌트를 확장하기 전에 onRequest를 필수로 해놨는데, 해명님이 사용하신 form 태그에서 onSubmit으로 제출하는 경우에는 onRequest가 따로 필요 없군요...! 나중에 해당 onRequest 옵션은 옵셔널로 바꿀까요?
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.
흠 저도 이 부분을 고민하긴 했는데, 다른 모달 컴포넌트 일관성을 고려했을 때는 남겨둬도 좋을 것 같아요. onRequest 가 기존 모달 컴포넌트들에서는 필수 콜백함수이기도 하고요 ! 현지님 생각은 어떠신가요?
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.
해명님 말씀처럼 기존 모달들, 특히 폼이 없는 모달들의 경우에는 필수로 있어야 되겠네요..! 그럼 우선은 필수로 해놓는 걸로 합시다~! 의견 감사합니다!
hyeonjiroh
left a comment
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.
모달 안에서 form 태그의 onSubmit을 사용하는 부분을 미처 생각하지 못하고 구현했는데, 대신 확장해주셔서 감사합니다...! 무사히 해결되어서 다행입니다!! 정말 고생 많으셨어요!! 👍
🔗 이슈 번호
Closes #177
📋 작업 사항
🔧 구현 흐름
⚒️ 공통 모달 기능 확장
응답 처리
📷 스크린샷
https://github.com/user-attachments/assets/79c94a85-f778-416c-8348-21d0544ff6e6
https://github.com/user-attachments/assets/78df77f1-a9de-471c-ba96-a67c17c4d6cd
📢 공유 사항
formattribute 사용)📚 참고 자료
<button>의 form attribute