fix likes

This commit is contained in:
Primakov Alexandr Alexandrovich 2023-11-03 15:15:47 +03:00
parent 38064eff2b
commit a8f111995f

View File

@ -34,7 +34,12 @@ router.post('/toggle-like', (req, res) => {
if (charLikes[charId]) { if (charLikes[charId]) {
const currentLikes = new Set(charLikes[charId].likes) const currentLikes = new Set(charLikes[charId].likes)
if (currentLikes.has(id)) {
currentLikes.delete(id)
} else {
currentLikes.add(id) currentLikes.add(id)
}
charLikes[charId].likes = [...currentLikes] charLikes[charId].likes = [...currentLikes]
} else { } else {