22
33import { getLetterCount } from '@/api/letter/letter' ;
44import { getUserInfo , logout } from '@/api/mypage/user' ;
5- import Button from '@/components/common/Button' ;
65import Loader , { LoaderContainer } from '@/components/common/Loader' ;
76import NavigatorBar from '@/components/common/NavigatorBar' ;
7+ import { OAUTH } from '@/constants/oauth' ;
88import { theme } from '@/styles/theme' ;
99import { clearOnboarding , clearTokens , getRefreshToken } from '@/utils/storage' ;
1010import { useRouter } from 'next/navigation' ;
@@ -65,7 +65,6 @@ const MyPage = () => {
6565 setName ( response . data . name ) ;
6666 setEmail ( response . data . email ) ;
6767 setPlatform ( response . data . socialPlatform ) ;
68- // console.log('회원정보 조회 성공:', response.data);
6968 } catch ( error ) {
7069 console . error ( '회원정보 조회 실패:' , error ) ;
7170 }
@@ -81,18 +80,9 @@ const MyPage = () => {
8180 }
8281 } ;
8382
84- const EmailType = ( platform ) : string => {
85- switch ( platform ) {
86- case 'GOOGLE' :
87- return '/assets/icons/ic_google.svg' ;
88- case 'KAKAO' :
89- return '/assets/icons/ic_kakao_profile.svg' ;
90- case 'NAVER' :
91- return '/assets/icons/ic_naver.svg' ;
92- default :
93- return '' ;
94- }
95- } ;
83+ const profileSrc = OAUTH . find (
84+ ( oauth ) => oauth . key === platform . toLowerCase ( )
85+ ) ?. profile ;
9686
9787 return (
9888 < Container >
@@ -112,11 +102,7 @@ const MyPage = () => {
112102 < ProfileInfo >
113103 < ProfileName > { name } 님의 스페이스</ ProfileName >
114104 < ProfileEmail >
115- < StyledIcon
116- src = { EmailType ( platform ) }
117- alt = "emailIcon"
118- platform = { platform as keyof typeof iconSizes }
119- />
105+ < StyledIcon src = { profileSrc } alt = { platform } />
120106 < div > { email } </ div >
121107 </ ProfileEmail >
122108 < CountRaw >
@@ -258,15 +244,9 @@ const ProfileImage = styled.img`
258244 }
259245` ;
260246
261- const iconSizes = {
262- GOOGLE : 20 ,
263- KAKAO : 20 ,
264- NAVER : 20
265- } as const ;
266-
267- const StyledIcon = styled . img < { platform : keyof typeof iconSizes } > `
268- width: ${ ( { platform } ) => iconSizes [ platform ] } px;
269- height: ${ ( { platform } ) => iconSizes [ platform ] } px;
247+ const StyledIcon = styled . img `
248+ width: 20px;
249+ height: 20px;
270250` ;
271251
272252const ProfileInfo = styled . div `
0 commit comments