@@ -46,6 +46,12 @@ const MyPage = () => {
46
46
navigate ( '/login' ) ;
47
47
} ;
48
48
49
+ useEffect ( ( ) => {
50
+ if ( ! userInfo ) {
51
+ navigate ( '/login' ) ;
52
+ }
53
+ } , [ userInfo ] ) ;
54
+
49
55
const handleClickRegisterButton = ( ) => {
50
56
navigate ( '/my/pet/register' ) ;
51
57
} ;
@@ -84,7 +90,7 @@ const MyPage = () => {
84
90
backgroundColor = { theme . palette . White }
85
91
margin = "0 0 10px"
86
92
>
87
- < Text typo = "Caption4 " colorCode = { theme . palette . Gray300 } >
93
+ < Text typo = "Label3 " colorCode = { theme . palette . Gray300 } >
88
94
등록된 유저 정보가 없습니다.
89
95
</ Text >
90
96
</ Flex >
@@ -113,29 +119,32 @@ const MyPage = () => {
113
119
gap = { 16 }
114
120
>
115
121
< Text typo = "Label3" colorCode = { theme . palette . Gray300 } >
116
- 앗! 등록된 반려견이 없어요 .
122
+ 등록된 반려견이 없습니다 .
117
123
</ Text >
118
- < Button
119
- typo = "Label4"
120
- fontColor = { theme . palette . White }
121
- onClick = { handleClickRegisterButton }
122
- bg = { theme . palette . Black }
123
- width = "135px"
124
- padding = "10px"
125
- borderRadius = "8px"
126
- >
127
- 마이펫 등록하러가기
128
- </ Button >
124
+ { userInfo && (
125
+ < Button
126
+ typo = "Label4"
127
+ fontColor = { theme . palette . White }
128
+ onClick = { handleClickRegisterButton }
129
+ bg = { theme . palette . Black }
130
+ width = "135px"
131
+ padding = "10px"
132
+ borderRadius = "8px"
133
+ >
134
+ 마이펫 등록하러가기
135
+ </ Button >
136
+ ) }
129
137
</ HeightFitFlex >
130
138
) }
139
+
131
140
< Flex direction = "column" margin = "8px 0" gap = { 8 } >
132
141
< Flex gap = { 10 } >
133
142
< FlexButton
134
143
padding = "13px 35px"
135
144
backgroundColor = { theme . palette . White }
136
145
borderRadius = { 8 }
137
146
gap = { 5 }
138
- onClick = { ( ) => handleNavigate ( '/my/shop' ) }
147
+ onClick = { ( ) => ( userInfo ? handleNavigate ( '/my/shop' ) : null ) }
139
148
>
140
149
< Store width = { 19 } />
141
150
< Text typo = "Label1" margin = "0 0 0 2px" >
@@ -147,7 +156,9 @@ const MyPage = () => {
147
156
backgroundColor = { theme . palette . White }
148
157
borderRadius = { 8 }
149
158
gap = { 5 }
150
- onClick = { ( ) => handleNavigate ( '/my/history' ) }
159
+ onClick = { ( ) =>
160
+ userInfo ? handleNavigate ( '/my/history' ) : null
161
+ }
151
162
>
152
163
< Scissors width = { 24 } height = { 24 } />
153
164
< Text typo = "Label1" > 이용기록</ Text >
@@ -158,17 +169,20 @@ const MyPage = () => {
158
169
backgroundColor = { theme . palette . White }
159
170
borderRadius = { 8 }
160
171
gap = { 10 }
161
- onClick = { ( ) => handleNavigate ( '/my/review' ) }
172
+ onClick = { ( ) => ( userInfo ? handleNavigate ( '/my/review' ) : null ) }
162
173
>
163
174
< Write width = { 18 } height = { 18 } />
164
175
< Text typo = "Label1" > 내가 쓴 후기</ Text >
165
176
</ FlexButton >
166
177
</ Flex >
167
- < FlexButton margin = "40px 0 0 0" onClick = { logout } >
168
- < Text typo = "Caption2" colorCode = { theme . palette . Gray300 } >
169
- 로그아웃
170
- </ Text >
171
- </ FlexButton >
178
+
179
+ { userInfo && (
180
+ < FlexButton margin = "40px 0 0 0" onClick = { logout } >
181
+ < Text typo = "Caption2" colorCode = { theme . palette . Gray300 } >
182
+ 로그아웃
183
+ </ Text >
184
+ </ FlexButton >
185
+ ) }
172
186
</ >
173
187
</ Flex >
174
188
< DuriNavbar />
0 commit comments