-
Notifications
You must be signed in to change notification settings - Fork 7
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]회원가입 기능 구현 #61
Merged
Merged
[FE]회원가입 기능 구현 #61
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
400c5ce
[Feat]이메일 유효성 검사 추가
dd05133
[Feat]OAuth로그인 모달 페이지
dc156cc
[Fix]뒤로가기 기능 롤백
9af3881
[Feat]이메일 props에 저장
4911901
[Feat] 약관 동의 체크리스트 구현
ba9bd1f
[Feat]비밀번호설정 구현
1c1b1db
[Feat]비밀번호 확인 및 환영 모달 구현
b7d1754
Merge branch 'dev-client' into dev-client#8/signuplogin
sirloinbh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// /client/src/components/Signups/EmailCertify.tsx | ||
import axios from 'axios'; | ||
import React, { useState } from 'react'; | ||
import styled from 'styled-components'; | ||
|
@@ -13,11 +14,15 @@ const strings = { | |
}; | ||
|
||
// 이메일 인증 모달 컴포넌트 | ||
const EmailVerificationModal: React.FC<EmailVerificationModalProps> = ({ onClose, onNextStep }) => { | ||
const EmailVerificationModal: React.FC<EmailVerificationModalProps> = ({ onClose, onNextStep, initialEmail }) => { | ||
// 이메일 및 인증코드에 대한 상태를 선언합니다. | ||
const [email, setEmail] = useState('[email protected]'); | ||
const [email, setEmail] = useState(initialEmail); | ||
const [verificationCode, setVerificationCode] = useState(''); | ||
|
||
// 동의 상태와 알림 상태를 선언합니다. | ||
const [hasAgreed, setHasAgreed] = useState(false); | ||
const [showAgreementError, setShowAgreementError] = useState(false); | ||
|
||
// 이메일 입력값을 처리하는 함수 | ||
const handleEmailChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
setEmail(event.target.value); | ||
|
@@ -28,8 +33,20 @@ const EmailVerificationModal: React.FC<EmailVerificationModalProps> = ({ onClose | |
setVerificationCode(event.target.value); | ||
}; | ||
|
||
// 체크박스의 변경을 감지하는 핸들러 | ||
const handleAgreementChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
setHasAgreed(event.target.checked); | ||
setShowAgreementError(false); // 알림을 숨깁니다. | ||
}; | ||
|
||
// 다음 단계 버튼 클릭시 이메일 인증을 처리하는 함수 | ||
const handleNextStepClick = async () => { | ||
// 동의 확인 | ||
if (!hasAgreed) { | ||
setShowAgreementError(true); // 알림을 표시합니다. | ||
return; | ||
} | ||
|
||
try { | ||
const response = await axios.post('http://ec2-13-125-246-160.ap-northeast-2.compute.amazonaws.com:8080/email/confirm', { email, code: verificationCode }); | ||
if (response.status === 200) { | ||
|
@@ -53,9 +70,11 @@ const EmailVerificationModal: React.FC<EmailVerificationModalProps> = ({ onClose | |
<Input type="text" placeholder={strings.codeHintText} value={verificationCode} onChange={handleVerificationCodeChange} /> | ||
<HintText>{strings.codeHintText}</HintText> | ||
<TermsCheckbox> | ||
<input type="checkbox" id="terms" /> | ||
<input type="checkbox" id="terms" onChange={handleAgreementChange} /> | ||
<label htmlFor="terms">{strings.termsText}</label> | ||
</TermsCheckbox> | ||
|
||
{showAgreementError && <ErrorMessage>동의하지 않으면 진행할 수 없습니다</ErrorMessage>} | ||
<SignupButton onClick={handleNextStepClick}> | ||
{strings.nextStepText} | ||
</SignupButton> | ||
|
@@ -70,6 +89,7 @@ export default EmailVerificationModal; | |
type EmailVerificationModalProps = { | ||
onClose: () => void; | ||
onNextStep: () => void; | ||
initialEmail: string; // 추가된 부분 | ||
}; | ||
|
||
// 모달의 배경 스타일 | ||
|
@@ -162,3 +182,11 @@ const TermsCheckbox = styled.div` | |
font-size: 0.9rem; | ||
} | ||
`; | ||
|
||
// 오류 메시지 스타일을 추가합니다. | ||
const ErrorMessage = styled.p` | ||
color: red; | ||
margin-top: 5px; | ||
margin-bottom: 10px; | ||
font-size: 0.8rem; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
end of line 지켜주세요~!