Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
divyalakshmi0 authored Oct 27, 2024
1 parent b9519c3 commit 00c8f62
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/routes/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ router.post('/send-message', async (req, res) => {
}
});

const handleLike = async () => {
if (!liked) {
await axios.post(`/posts/${postId}/like`);
} else {
await axios.delete(`/posts/${postId}/like`);
}
setLiked(!liked); // Update UI state
fetchPostData(); // Re-fetch or update post data
};
<span>{post.likes} Reactions</span>


// function insertPostData() {
// Post.insertMany([
// {
Expand Down

0 comments on commit 00c8f62

Please sign in to comment.