@@ -4,14 +4,14 @@ import { useParams } from 'react-router-dom';
44import { initialUserData } from 'contexts/UserContext/reducer' ;
55import { useUserContext } from 'contexts/UserContext' ;
66import { getUser } from 'utils/apis/userApi' ;
7- import { getUserPosts , getPostData } from 'utils/apis/postApi' ;
7+ import { getPostData } from 'utils/apis/postApi' ;
88import {
99 GRID_INACTIVE ,
1010 GRID_ACTIVE ,
1111 HEART_INACTIVE ,
1212 HEART_ACTIVE ,
1313} from 'utils/constants/icons/names' ;
14- import { UserContainter } from './style' ;
14+ import { UserContainer } from './style' ;
1515import UserData from './UserData' ;
1616import getUserLevel from 'utils/functions/userLevel/getUserLevel' ;
1717
@@ -33,23 +33,16 @@ const UserPage = () => {
3333 setCurrentTab ( value ) ;
3434 } ;
3535
36- const handleGetUserPosts = useCallback ( async ( ) => {
37- if ( pageUserId ) {
38- const { data } = await getUserPosts ( pageUserId ) ;
39- setUserPosts ( data ) ;
40- }
41- } , [ pageUserId ] ) ;
42-
4336 const handleGetUser = useCallback ( async ( ) => {
4437 if ( pageUserId ) {
4538 const { data } = await getUser ( pageUserId ) ;
4639 setUser ( data ) ;
4740 const { posts, comments, followers } = data ;
4841 const { level } = getUserLevel ( { posts, comments, followers } ) ;
42+ setUserPosts ( posts ) ;
4943 setUserLevel ( level ) ;
50- await handleGetUserPosts ( ) ;
5144 }
52- } , [ pageUserId , handleGetUserPosts ] ) ;
45+ } , [ pageUserId ] ) ;
5346
5447 const handleGetLikePosts = useCallback ( async ( ) => {
5548 const { likes } = user ;
@@ -73,7 +66,7 @@ const UserPage = () => {
7366
7467 return (
7568 < PageWrapper header prev nav info = { currentUser . id === pageUserId } >
76- < UserContainter >
69+ < UserContainer >
7770 < UserData user = { user } pageUserId = { pageUserId } userLevel = { userLevel } />
7871 < Tab onActive = { onActive } >
7972 < Tab . Item
@@ -95,7 +88,7 @@ const UserPage = () => {
9588 < PostImageContainer posts = { userLikePosts } />
9689 </ Tab . Item >
9790 </ Tab >
98- </ UserContainter >
91+ </ UserContainer >
9992 </ PageWrapper >
10093 ) ;
10194} ;
0 commit comments