From a3ddd525d0468ca1caca222edfb472ca2bf943ab Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Tue, 3 Jul 2018 12:32:44 +0200 Subject: [PATCH] Updated comments creation request --- assets/js/components/comments/form.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/js/components/comments/form.js b/assets/js/components/comments/form.js index 8c8aa24d..8b4a0993 100644 --- a/assets/js/components/comments/form.js +++ b/assets/js/components/comments/form.js @@ -124,8 +124,15 @@ ComunicWeb.components.comments.form = { //Lock send button sendButton.disabled = true; - //Try to create the comment - var formData = new FormData(commentForm); + //Prepare the request + var formData = new FormData(); + formData.append("content", newCommentText.value); + + //Check for image + if(imageFile.files.length > 0) + formData.append("image", imageFile.files[0], imageFile.files[0].name); + + //Send the request ComunicWeb.components.comments.interface.create(postID, formData, function(result){ //Unlock send button