File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
components/pages/mypage/user Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ import LoadingIcon from "@icons/loading-icon";
1313import { useRouter } from "next/navigation" ;
1414import { useState } from "react" ;
1515
16+ const MIN_USERNAME_LENGTH = 3 ;
17+
1618interface UsernameCardProps {
1719 user : User ;
1820}
@@ -35,6 +37,12 @@ const UsernameCard = ({ user }: UsernameCardProps) => {
3537 setLoading ( false ) ;
3638 return ;
3739 }
40+
41+ if ( username . value . length < MIN_USERNAME_LENGTH ) {
42+ setEditError ( "사용자 이름은 최소 3자 이상이어야 합니다." ) ;
43+ setLoading ( false ) ;
44+ return ;
45+ }
3846 const response = await updateUserName ( username . value ) ;
3947
4048 if ( ! response . ok ) {
@@ -80,7 +88,7 @@ const UsernameCard = ({ user }: UsernameCardProps) => {
8088 < Button
8189 onClick = { changeUsername }
8290 className = "text-sm w-14 h-8 p-0 flex items-center justify-center"
83- disabled = { username . value . length < 2 || loading }
91+ disabled = { loading }
8492 >
8593 { loading ? (
8694 < LoadingIcon size = "sm" className = "text-white m-0" />
You can’t perform that action at this time.
0 commit comments