@@ -13,19 +13,26 @@ import { Button } from '@/components/ui/Button';
1313export default function SignupPage ( ) {
1414 const toast = useToast ( ) ;
1515 const router = useRouter ( ) ;
16- const [ username , setUsername ] = useState ( '' ) ;
1716 const [ email , setEmail ] = useState ( '' ) ;
17+ const [ name , setName ] = useState ( '' ) ;
1818 const [ password , setPassword ] = useState ( '' ) ;
19- const [ confirmPassword , setConfirmPassword ] = useState ( '' ) ;
19+ const [ passwordCheck , setPasswordCheck ] = useState ( '' ) ;
20+ const [ imageUrl , setImageUrl ] = useState ( '' ) ;
2021 const [ loading , setLoading ] = useState ( false ) ;
2122
2223 async function submit ( e : FormEvent ) {
2324 e . preventDefault ( ) ;
24- if ( password !== confirmPassword ) {
25+ if ( password !== passwordCheck ) {
2526 toast . push ( '비밀번호가 일치하지 않습니다.' ) ;
2627 return ;
2728 }
28- const payload : SignupRequest = { username, email, password, confirmPassword } ;
29+ const payload : SignupRequest = {
30+ email,
31+ name,
32+ password,
33+ passwordCheck,
34+ imageUrl : imageUrl || undefined
35+ } ;
2936 try {
3037 setLoading ( true ) ;
3138 const res = await authApi . signup ( payload ) ;
@@ -49,25 +56,61 @@ export default function SignupPage() {
4956 < CardContent >
5057 < form className = "space-y-6" onSubmit = { submit } >
5158 < div className = "space-y-2" >
52- < Label htmlFor = "username" > 아이디</ Label >
53- < Input id = "username" value = { username } onChange = { ( e ) => setUsername ( e . target . value ) } required />
59+ < Label htmlFor = "email" > 이메일</ Label >
60+ < Input
61+ id = "email"
62+ type = "email"
63+ value = { email }
64+ onChange = { ( e ) => setEmail ( e . target . value ) }
65+ 66+ required
67+ />
5468 </ div >
5569 < div className = "space-y-2" >
56- < Label htmlFor = "email" > 이메일</ Label >
57- < Input id = "email" type = "email" value = { email } onChange = { ( e ) => setEmail ( e . target . value ) } required />
70+ < Label htmlFor = "name" > 이름</ Label >
71+ < Input
72+ id = "name"
73+ value = { name }
74+ onChange = { ( e ) => setName ( e . target . value ) }
75+ placeholder = "사용할 이름을 입력하세요"
76+ required
77+ />
5878 </ div >
5979 < div className = "space-y-2" >
6080 < Label htmlFor = "password" > 비밀번호</ Label >
61- < Input id = "password" type = "password" value = { password } onChange = { ( e ) => setPassword ( e . target . value ) } required />
81+ < Input
82+ id = "password"
83+ type = "password"
84+ value = { password }
85+ onChange = { ( e ) => setPassword ( e . target . value ) }
86+ placeholder = "8자 이상 입력하세요"
87+ required
88+ />
89+ </ div >
90+ < div className = "space-y-2" >
91+ < Label htmlFor = "passwordCheck" > 비밀번호 확인</ Label >
92+ < Input
93+ id = "passwordCheck"
94+ type = "password"
95+ value = { passwordCheck }
96+ onChange = { ( e ) => setPasswordCheck ( e . target . value ) }
97+ placeholder = "비밀번호를 다시 입력하세요"
98+ required
99+ />
62100 </ div >
63101 < div className = "space-y-2" >
64- < Label htmlFor = "confirmPassword" > 비밀번호 확인</ Label >
65- < Input id = "confirmPassword" type = "password" value = { confirmPassword } onChange = { ( e ) => setConfirmPassword ( e . target . value ) } required />
102+ < Label htmlFor = "imageUrl" > 사진 주소 (선택사항)</ Label >
103+ < Input
104+ id = "imageUrl"
105+ type = "url"
106+ value = { imageUrl }
107+ onChange = { ( e ) => setImageUrl ( e . target . value ) }
108+ placeholder = "https://example.com/profile.jpg"
109+ />
66110 </ div >
67111 < Button type = "submit" className = "w-full" size = "lg" disabled = { loading } >
68112 { loading ? '처리중...' : '회원가입' }
69113 </ Button >
70- < p className = "text-xs text-muted-foreground" > 스프링 엔드포인트: POST /api/v1/auth/signup</ p >
71114 </ form >
72115 </ CardContent >
73116 </ Card >
0 commit comments