1- import { useState } from 'react' ;
1+ import { useEffect , useState } from 'react' ;
22import { useNavigate } from 'react-router-dom' ;
33
4- import { patchUserInfoApi } from '@apis/user' ;
4+ import { getUserInfoApi , patchUserInfoApi } from '@apis/user' ;
55import { PatchUserInfoRequest } from '@apis/user/dto' ;
66import { getCurrentUserId } from '@utils/getCurrentUserId' ;
77import { styleImages } from '@utils/styleImages' ;
@@ -16,6 +16,7 @@ import TopBar from '@components/TopBar';
1616import { PickMyStyleLayout , StyledSubTitle , StyledTitle , CategoryList , PlaceholderImage } from './style' ;
1717
1818const PickMyStyle : React . FC = ( ) => {
19+ const [ nickname , setNickname ] = useState ( '' ) ;
1920 const [ clickedImages , setClickedImages ] = useState < { [ key : number ] : boolean } > ( { } ) ;
2021
2122 const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
@@ -24,6 +25,19 @@ const PickMyStyle: React.FC = () => {
2425 const navigate = useNavigate ( ) ;
2526 const currentUserId = getCurrentUserId ( ) ;
2627
28+ // 유저 정보 가져오기
29+ useEffect ( ( ) => {
30+ const fetchUserInfo = async ( ) => {
31+ try {
32+ const userInfo = await getUserInfoApi ( currentUserId ) ;
33+ setNickname ( userInfo . data . nickname ) ;
34+ } catch ( error ) {
35+ console . error ( '유저 정보 불러오기 실패:' , error ) ;
36+ }
37+ } ;
38+ fetchUserInfo ( ) ;
39+ } , [ currentUserId ] ) ;
40+
2741 // 이미지 클릭 시 상태 변경
2842 const handleImageClick = ( id : number ) => {
2943 setClickedImages ( ( prev ) => ( {
@@ -70,14 +84,14 @@ const PickMyStyle: React.FC = () => {
7084 < PickMyStyleLayout >
7185 < StyledTitle
7286 $textTheme = { {
73- style : { mobile : 'title3 -bold' , tablet : 'title2-bold' , desktop : 'title1 -bold' } ,
87+ style : { mobile : 'heading1 -bold' , tablet : 'title2-bold' , desktop : 'title2 -bold' } ,
7488 } }
7589 >
76- 스타일을 선택해주세요 !
90+ { nickname } 님의 취향을 알려주세요 !
7791 </ StyledTitle >
7892 < StyledSubTitle
7993 $textTheme = { {
80- style : { mobile : 'caption1-medium' , tablet : 'body2-medium' , desktop : 'body1 -medium' } ,
94+ style : { mobile : 'caption1-medium' , tablet : 'body2-medium' , desktop : 'body2 -medium' } ,
8195 } }
8296 >
8397 OODD가 당신의 취향을 분석하여 맞춤 스타일을 추천해 드릴게요.
0 commit comments