Skip to content

Commit 41d682b

Browse files
authored
merge: userPosts state 삭제, 프로필 변경 이미지 추가
refactor: userPosts state 삭제, 프로필 변경 이미지 추가
2 parents 38113fc + 86fe012 commit 41d682b

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/components/ChangeProfileModal/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Button, Text, UploadImage } from 'components';
22
import styled from '@emotion/styled';
33
import useClickAway from '../../hooks/useClickAway';
44

5-
const ChangeProfileModal = ({ onFileChange, onProfileSubmit, onClose }) => {
5+
const ChangeProfileModal = ({ onFileChange, onProfileSubmit, onClose, currentProfile }) => {
66
const ref = useClickAway(() => {
77
onClose && onClose();
88
});
@@ -13,6 +13,7 @@ const ChangeProfileModal = ({ onFileChange, onProfileSubmit, onClose }) => {
1313
프로필을 변경하시겠습니까?
1414
</Text>
1515
<UploadImage
16+
defaultImage={currentProfile}
1617
onChange={onFileChange}
1718
style={{ width: '90%', marginLeft: 'auto', marginRight: 'auto', marginTop: '30px' }}
1819
/>{' '}

src/pages/MyInfoPage/UserProfile.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const UserProfile = () => {
101101
onFileChange={onFileChange}
102102
onProfileSubmit={onProfileSubmit}
103103
onClose={onCloseProfile}
104+
currentProfile={currentUser.image}
104105
/>
105106
)}
106107
</UserProfileWrapper>

src/pages/UserPage/index.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const UserPage = () => {
2424
const { currentUser } = useUserContext();
2525
const [user, setUser] = useState(initialUserData.currentUser);
2626
const [userLevel, setUserLevel] = useState({});
27-
const [userPosts, setUserPosts] = useState([]);
2827
const [userLikePosts, setUserLikePosts] = useState([]);
2928

3029
const [currentTab, setCurrentTab] = useState(USER_POSTS);
@@ -39,7 +38,6 @@ const UserPage = () => {
3938
setUser(data);
4039
const { posts, comments, followers } = data;
4140
const { level } = getUserLevel({ posts, comments, followers });
42-
setUserPosts(posts);
4341
setUserLevel(level);
4442
}
4543
}, [pageUserId]);
@@ -76,7 +74,7 @@ const UserPage = () => {
7674
}}
7775
index={USER_POSTS}
7876
>
79-
<PostImageContainer posts={userPosts} />
77+
<PostImageContainer posts={user.posts} />
8078
</Tab.Item>
8179
<Tab.Item
8280
icon={{

0 commit comments

Comments
 (0)