File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { useUserInfo,useUserUpdate } from '../../../features/join/hooks/useUserH
1010import useAuthStore from '../../../app/provider/authStore' ;
1111
1212const MyPage = ( ) => {
13- const { data} = useUserInfo ( ) ;
13+ const { data, isLoading , error } = useUserInfo ( ) ;
1414 const { mutate : updateUser } = useUserUpdate ( ) ;
1515 const { setName } = useAuthStore ( ) ;
1616
@@ -41,7 +41,7 @@ const MyPage = () => {
4141 } ;
4242 updateUser ( updatedData , {
4343 onSuccess : ( ) => {
44- setName ( data ?. name || "사용자" ) ;
44+ setName ( name ) ;
4545 alert ( '정보가 성공적으로 업데이트되었습니다.' ) ;
4646 } ,
4747 onError : ( err ) => {
@@ -62,6 +62,12 @@ const MyPage = () => {
6262 setIsChanged ( changeMessage ) ; // 변경 상태 업데이트
6363
6464 } ;
65+ if ( isLoading ) {
66+ return < div > 로딩 중...</ div > ;
67+ }
68+ if ( error ) {
69+ return < div > 정보를 불러오는데 실패했습니다. 다시 시도해주세요.</ div > ;
70+ }
6571 return (
6672 < div >
6773 < Header leftButtonLabel = "마이페이지" leftButtonClassName = "font-bold text-2xl" />
You can’t perform that action at this time.
0 commit comments