Skip to content

Commit

Permalink
feat:회원가입 api
Browse files Browse the repository at this point in the history
  • Loading branch information
seoyoung7623 committed May 31, 2023
1 parent 6150552 commit 37a2aba
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
41 changes: 30 additions & 11 deletions src/pages/main/SignUpChoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,12 @@ const SignUpChoose = () => {
config
)
.then((response) => {
alert("이메일을 전송했습니다.");
setEmailMessage("이메일을 전송하였습니다.");
setAuthenticationCode(response.data.authenticationCode);
console.log(response.data.authenticationCode);
})
.catch((err) => {
alert("이메일 전송에 실패하였습니다.");
console.log(err);
setEmailMessage("이메일 전송에 실패하였습니다.");
// console.log(err);
});
};

Expand Down Expand Up @@ -208,15 +207,16 @@ const SignUpChoose = () => {
setEmailMessage("이메일형식이 올바르지 않습니다.");
} else {
setEmailMessage("");
// alert("이메일 전송 완료 (api실행 x)");
emailauth();
}
};

// 이메일 인증 코드 확인
const handledClickEmailCheckBtn = (e) => {
if (emailCheck === authenticationCode) {
setEmailCheckMessage("✅ 이메일 인증이 성공적으로 완료되었습니다.");
if (authenticationCode !== "" && emailCheck === authenticationCode) {
setIsEmailCheck(true);
setEmailCheckMessage("✅ 이메일 인증이 성공적으로 완료되었습니다.");
} else {
setEmailCheckMessage("인증번호가 올바르지 않습니다.");
}
Expand All @@ -236,8 +236,17 @@ const SignUpChoose = () => {
isGender === true &&
isBirth === true
) {
console.log(phoneNumber);
registeraxios();
alert("회원가입 완료");
// console.log({
// email: email,
// password: password,
// userName: name,
// gender: gender,
// birth: birth,
// phoneNumber: `${phoneNumber.fstNum}-${phoneNumber.secNum}-${phoneNumber.thrNum}`,
// role: userType,
// });
// registeraxios();
event.preventDefault();
}
if (isEmail === false) {
Expand Down Expand Up @@ -302,15 +311,20 @@ const SignUpChoose = () => {
ref={emailInput}
type="email"
value={email}
placeholder="test@email.com"
placeholder="wazard123@email.com"
onChange={onEmailHandler}
/>{" "}
<button className="button_send" onClick={handledClickEmailBtn}>
{" "}
이메일 인증
</button>
</div>
<p className="message">{emailMessage}</p>
{isEmail ? (
<p className="message-succes">{emailMessage}</p>
) : (
<p className="message">{emailMessage}</p>
)}

<div className="Form">
<div className="registerLabel">
<label>이메일 인증번호</label>
Expand All @@ -325,7 +339,12 @@ const SignUpChoose = () => {
인증 확인
</button>
</div>
<p className="message">{emailCheckMessage}</p>
{isEmailCheck ? (
<p className="message-succes">{emailCheckMessage}</p>
) : (
<p className="message">{emailCheckMessage}</p>
)}

<div className="Form">
<div className="registerLabel">
<label>비밀번호</label>
Expand Down
6 changes: 6 additions & 0 deletions src/pages/main/SignUpChoose.scss
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@
width: 100vh;
font-size: 13px;
}
.message-succes {
color: #424242;
margin-left: 50px;
width: 100vh;
font-size: 13px;
}

// button
.button_send {
Expand Down

0 comments on commit 37a2aba

Please sign in to comment.