diff --git a/Site Web/client/src/components/Post/ButtonLike.js b/Site Web/client/src/components/Post/ButtonLike.js
index ae1d5cb5..d6305868 100644
--- a/Site Web/client/src/components/Post/ButtonLike.js
+++ b/Site Web/client/src/components/Post/ButtonLike.js
@@ -6,7 +6,7 @@ import CoeurPlein from '../../assets/img/coeursPlein.png';
import { likePost, unlikePost } from '../../actions/post.actions';
const ButtonLike = ( { post } ) => {
- const [liked, setLiked] = useState(false);
+ /*const [liked, setLiked] = useState(false);
const uid = useContext(UidContext);
const dispatch = useDispatch();
@@ -33,13 +33,44 @@ const ButtonLike = ( { post } ) => {
return (
{uid && liked === false && (
-

+

)}
{uid && liked && (

)}
- );
+ );*/
+
+ const [likes, setLikes] = useState(post.likers.length);
+ const [liked, setLiked] = useState(false);
+ const uid = useContext(UidContext);
+ const dispatch = useDispatch();
+
+ const handleLike = () => {
+ if (!liked) {
+ setLikes(likes + 1);
+ dispatch(unlikePost(post._id, uid));
+ setLiked(true);
+ } else {
+ setLikes(likes - 1);
+ dispatch(unlikePost(post._id, uid));
+ setLiked(false);
+ }
+ }
+
+ return (
+ <>
+
+ {uid && liked === false && (
+

)
+ }
+ {uid && liked && (
+

+ )}
+
+ {likes}
+ >
+ )
};
export default ButtonLike;
\ No newline at end of file
diff --git a/Site Web/client/src/components/Post/Post.js b/Site Web/client/src/components/Post/Post.js
index 1f197a7a..29007eba 100644
--- a/Site Web/client/src/components/Post/Post.js
+++ b/Site Web/client/src/components/Post/Post.js
@@ -75,7 +75,6 @@ const Post = ( { post } ) => {