fixed edit

This commit is contained in:
zipben 2025-06-04 14:09:25 +00:00
parent 5fe3fd7f76
commit c5ddede56e

View file

@ -944,16 +944,17 @@ export default {
}, },
async saveEdit(comment) { async saveEdit(comment) {
try { try {
const response = await this.$axios.put(`/api/items/${this.libraryItem.id}/comments/${comment.id}`, { const response = await this.$axios.$patch(`/api/items/${this.libraryItemId}/comments/${comment.id}`, {
text: this.editCommentText.trim(), text: this.editCommentText.trim(),
rating: this.editRating || null rating: this.editRating || null
}) })
const index = this.comments.findIndex((c) => c.id === comment.id) const index = this.comments.findIndex((c) => c.id === comment.id)
this.comments.splice(index, 1, response.data) this.comments.splice(index, 1, response)
this.cancelEdit() this.cancelEdit()
this.$toast.success(this.$strings.MessageCommentUpdated) this.$toast.success(this.$strings.MessageCommentUpdated)
} catch (error) { } catch (error) {
console.error('Error updating comment:', error)
this.$toast.error(this.$strings.ErrorUpdatingComment) this.$toast.error(this.$strings.ErrorUpdatingComment)
} }
}, },