@@ -22,6 +22,7 @@ const LoginForm = ({ handleOpenModal }: LoginFormProps) => {
2222 const [ email , setEmail ] = useState ( '' ) ;
2323 const [ password , setPassword ] = useState ( '' ) ;
2424 const [ error , setError ] = useState ( '' ) ;
25+ const [ isLoading , setIsLoading ] = useState ( false ) ;
2526
2627 const router = useRouter ( ) ;
2728
@@ -48,9 +49,13 @@ const LoginForm = ({ handleOpenModal }: LoginFormProps) => {
4849 e . preventDefault ( ) ;
4950 setError ( '' ) ;
5051
52+ if ( isLoading ) return ;
53+ setIsLoading ( true ) ;
54+
5155 // 유효성 검사
5256 if ( ! email || ! password ) {
5357 setError ( '이메일과 비밀번호를 모두 입력해주세요.' ) ;
58+ setIsLoading ( false ) ;
5459 return ;
5560 }
5661
@@ -65,6 +70,7 @@ const LoginForm = ({ handleOpenModal }: LoginFormProps) => {
6570 } catch ( err ) {
6671 console . error ( '로그인 에러:' , err ) ;
6772 setError ( '이메일 또는 비밀번호가 잘못되었습니다.' ) ;
73+ setIsLoading ( false ) ;
6874 }
6975 } ;
7076
@@ -99,7 +105,7 @@ const LoginForm = ({ handleOpenModal }: LoginFormProps) => {
99105 비밀번호를 잊으셨나요?
100106 </ button >
101107 < Button className = "mt-6" type = "submit" >
102- 이메일로 로그인하기
108+ { isLoading ? '로그인 중...' : ' 이메일로 로그인하기' }
103109 </ Button >
104110
105111 < p className = "text-text-sub mt-4 text-center text-sm" >
@@ -117,7 +123,12 @@ const LoginForm = ({ handleOpenModal }: LoginFormProps) => {
117123 < div className = "bg-border h-px flex-1" />
118124 </ div >
119125
120- < Button variant = "github" onClick = { handleGithubLogin } type = "button" >
126+ < Button
127+ variant = "github"
128+ onClick = { handleGithubLogin }
129+ type = "button"
130+ disabled = { isLoading }
131+ >
121132 < FaGithub className = "text-xl" />
122133 < span > Github로 로그인</ span >
123134 </ Button >
0 commit comments