Skip to content

Commit

Permalink
fix: globalStore의 currentUser값 사용하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hanghaehyunjin committed Dec 26, 2024
1 parent 744a7cc commit e5ec74f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/pages/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { createVNode } from "../lib";

import { Footer, Header, Navigation, Post, PostForm } from "../components";
import { globalStore } from "../stores";
import { userStorage } from "../storages";

/**
* 심화과제
Expand All @@ -12,11 +11,11 @@ import { userStorage } from "../storages";
* - 로그인하지 않은 사용자가 게시물에 좋아요를 누를 경우, "로그인 후 이용해주세요"를 alert로 띄운다.
*/
export const HomePage = () => {
const { posts, loggedIn } = globalStore.getState();
const { posts, loggedIn, currentUser } = globalStore.getState();

const isChecked = (likeUsers) => {
return likeUsers.find((postLike) =>
postLike.includes(userStorage.get("user")?.username),
postLike.includes(currentUser.username),
);
};

Expand Down

0 comments on commit e5ec74f

Please sign in to comment.