BamaCharanChhandogi / GitFinder

GitFinder is a vibrant hub for developers, offering a space to showcase projects, discover coding trends, and connect with peers worldwide. Showcase your coding prowess, explore diverse projects, engage in discussions, and stay updated on the latest in the coding community.
https://gitfinder-psi.vercel.app/
MIT License
18 stars 42 forks source link

Fixed Likes Logic for Blog and Post #61

Closed ParasY1724 closed 1 month ago

ParasY1724 commented 1 month ago

Issue No: #58

Description: Array of Username for likedBy is maintain to keep track of users likes . Logic for handle submit:

const newLikedUsers = liked
      ? likedUsers.filter(user => user !== currentUser)
      : [...likedUsers, currentUser];

 const newLikeCount = newLikedUsers.length;

NOTE : This will work only for post / blogs created after this , old posts / blog as don't have track of array

I will recommend to delete all posts & blod from DB to avoid any errorrs