From 749bc523d660ceac6721a43f94c0bfe0eeaf9040 Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Sat, 11 Dec 2021 03:10:04 +0530 Subject: [PATCH] Fixed issue with like count going out of sync with actual count --- template/index.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/template/index.html b/template/index.html index 0cb48e7..7e50b85 100644 --- a/template/index.html +++ b/template/index.html @@ -1821,24 +1821,23 @@ input{ duration: 150, ease: 'easing', } - const likeCount = parseInt(getRef('like_count').textContent) - const newCount = likeCount ? likeCount + 1 : 1 + totalVotes++ getRef('like_count').animate(slideOutUp, animOptions) .onfinish = (e) => { e.target.cancel() } const tempCount = document.createElement('div') tempCount.classList.add('temp-count') - tempCount.textContent = newCount + tempCount.textContent = totalVotes getRef('like_count').after(tempCount) tempCount.animate(slideInUp, animOptions) .onfinish = () => { - getRef('like_count').textContent = newCount + getRef('like_count').textContent = totalVotes tempCount.remove() } floCloudAPI.sendGeneralData({ articleID: currentArticleID, - }, 'article_votes') + }, `article_${currentArticleID}_votes`) .then(res => { console.log('upvoted') }) @@ -1948,14 +1947,15 @@ input{