Skip to content

Commit

Permalink
updated like and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Nacnus committed Feb 23, 2024
1 parent 195af7f commit fa13ecd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@

<v-card v-if="item.commentVisible">
<v-text-field v-model="newComment" @keydown.enter="commentSend(item,newComment)" />
<v-btn @click="commentSend(item, $event.target.value)">
<v-btn @click="commentSend(item, newComment)">
GÖNDER
</v-btn>
</v-card>
Expand Down Expand Up @@ -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()
Expand All @@ -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 = ''
})
}
}
Expand Down

0 comments on commit fa13ecd

Please sign in to comment.