From fa13ecdb952911bf8f223de5b751ee622867d87c Mon Sep 17 00:00:00 2001 From: Yusuf Can Sun Date: Fri, 23 Feb 2024 21:02:51 +0300 Subject: [PATCH] updated like and comments --- pages/index.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pages/index.vue b/pages/index.vue index bf39e5d..650a510 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -189,7 +189,7 @@ - + GÖNDER @@ -285,7 +285,13 @@ export default { }, postLike (item) { item.liked = !item.liked - this.$axios.post(process.env.POST_LIKE_URL.replace('{uuid}', item.uuid)) + + if (item.liked === true) { + this.$axios.post(process.env.POST_LIKE_URL.replace('{uuid}', item.uuid)) + return item.liked + } else { + this.$axios.post(process.env.POST_UNLIKE_URL.replace('{uuid}', item.uuid)) + } }, logout () { this.$auth.logout() @@ -305,11 +311,13 @@ export default { }, commentSend (item, newComment) { const params = { + post: item.uuid, text: newComment } this.$axios.$post('/api/pages/comment/', params) .then((res) => { - console.log(res) + item.comments.push(res) + this.newComment = '' }) } }