fix likes
This commit is contained in:
parent
38064eff2b
commit
a8f111995f
@ -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)
|
||||||
currentLikes.add(id)
|
|
||||||
|
if (currentLikes.has(id)) {
|
||||||
|
currentLikes.delete(id)
|
||||||
|
} else {
|
||||||
|
currentLikes.add(id)
|
||||||
|
}
|
||||||
|
|
||||||
charLikes[charId].likes = [...currentLikes]
|
charLikes[charId].likes = [...currentLikes]
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user