diff --git a/src/components/posts/Post.jsx b/src/components/posts/Post.jsx index 8d882b4..6bc1442 100644 --- a/src/components/posts/Post.jsx +++ b/src/components/posts/Post.jsx @@ -3,14 +3,8 @@ import { addEvent, createVNode } from "../../lib"; import { globalStore } from "../../stores/globalStore.js"; import { toTimeFormat } from "../../utils/index.js"; -export const Post = ({ - id, - author, - time, - content, - likeUsers, - activationLike = false, -}) => { +export const Post = ({ id, author, time, content, likeUsers }) => { + const { currentUser } = globalStore.getState(); const { like } = globalStore.actions; const onClickLike = () => { @@ -28,7 +22,7 @@ export const Post = ({

{content}

좋아요 {likeUsers.length} diff --git a/src/stores/globalStore.js b/src/stores/globalStore.js index 94f58d3..f912a09 100644 --- a/src/stores/globalStore.js +++ b/src/stores/globalStore.js @@ -65,10 +65,8 @@ export const globalStore = createStore( post.likeUsers = post.likeUsers.filter( (username) => username !== state.currentUser.username, ); - post.activationLike = false; } else { post.likeUsers.push(state.currentUser.username); - post.activationLike = true; } }, },