@@ -58,7 +58,7 @@ export default function Signup() {
5858 } , [ ] ) ;
5959
6060 // 첫 번째 화면에서 다음 버튼 클릭 시 처리
61- const handleNext = ( ) => {
61+ const handleNext = async ( ) => {
6262 if ( ! name || ! email || ! password || ! confirmPassword ) {
6363 alert ( "모든 칸을 채워주세요." ) ;
6464 return ;
@@ -67,11 +67,24 @@ export default function Signup() {
6767 alert ( "비밀번호가 일치하지 않습니다." ) ;
6868 return ;
6969 }
70- if ( email === "pwc2002" ) {
70+
71+ const checkEmail = await apiClient . get ( '/auth/check' , {
72+ params : {
73+ email : email
74+ }
75+ } )
76+ if ( checkEmail . data . data . isDuplicated ) {
7177 setIsEmailValid ( true ) ;
72- alert ( "이미 가입된 이메일입니다." ) ;
7378 return ;
7479 }
80+
81+ if ( checkEmail . data . code != 200 ) {
82+ alert ( "에러가 발생하였습니다." ) ;
83+ return ;
84+ }
85+
86+
87+
7588 if ( errors . length > 0 ) {
7689 alert ( "비밀번호 조건을 만족해주세요." ) ;
7790 return ;
@@ -109,6 +122,12 @@ export default function Signup() {
109122 try {
110123 const res = await apiClient . post ( '/auth/signup' , userinfo ) ;
111124 console . log ( res ) ;
125+ if ( res . data . code == 200 ) {
126+ console . log ( res . data . message ) ;
127+ router . push ( "/auth/signin" ) ;
128+ } else {
129+ alert ( res . data . message ) ;
130+ }
112131 } catch ( error ) {
113132 console . log ( error ) ;
114133 }
@@ -128,10 +147,10 @@ export default function Signup() {
128147
129148 return (
130149 < div className = "flex flex-col w-full items-center justify-start h-screen bg-black" >
131- < div className = "flex flex-col max-w-[414px] w-full h-full pt-[30px] px-5" >
132- < p className = "text-white text-xl font-bold mb-2" > 회원가입하기</ p >
150+ < div className = "flex flex-col max-w-[414px] w-full h-full px-5 " >
151+ { /* <p className="text-white text-xl font-bold mb-2">회원가입하기</p> */ }
133152
134- < div className = "relative w-full h-full overflow-y-scroll" >
153+ < div className = "relative w-full h-full overflow-y-scroll flex flex-col justify-center " >
135154 < div key = "screen1" className = { `absolute w-full transition-all duration-500 ease-in-out transform ${ isAnimating ? "-translate-x-full opacity-0" : "translate-x-0 opacity-100" } ` } >
136155 < ProfileInfoForm
137156 name = { name }
@@ -146,6 +165,7 @@ export default function Signup() {
146165 isEmailValid = { isEmailValid }
147166 isNameDisabled = { isNameDisabled }
148167 isEmailDisabled = { isEmailDisabled }
168+ setIsEmailValid = { setIsEmailValid }
149169 />
150170 </ div >
151171
@@ -167,7 +187,7 @@ export default function Signup() {
167187 className = "text-white bg-[#EA4336] w-full h-[48px] rounded-full"
168188 style = { { boxShadow : "black 0px -10px 20px 10px" } }
169189 onPress = { isAnimating ? handleSignup : handleNext }
170- isDisabled = { ! isAnimating && ( ! name || ! email || ! password || ! confirmPassword || errors . length > 0 || password !== confirmPassword ) }
190+ isDisabled = { ! isAnimating && ( ! name || ! email || ! password || ! confirmPassword || errors . length > 0 || password !== confirmPassword || isEmailValid ) }
171191 >
172192 { isAnimating ? "가입하기" : "다음" }
173193 </ Button >
0 commit comments