diff --git a/src/services/feature-api.js b/src/services/feature-api.js index 49e40e12cb27cfe4043577a7cc66ca307cbf64a7..8c1a8eb3a7f0ecf1ba2e72127baa65aac36e0285 100644 --- a/src/services/feature-api.js +++ b/src/services/feature-api.js @@ -37,7 +37,7 @@ const featureAPI = { `${baseUrl}features/${featureId}/comments/`, { comment } ); if ( - response.status === 200 && + response.status === 201 && response.data ) { return response; @@ -46,16 +46,13 @@ const featureAPI = { } }, - async postCommentAttachment({ featureId, file, fileName, comment }) { + async postCommentAttachment({ featureId, file, fileName, commentId, title }) { let formdata = new FormData(); formdata.append("file", file, fileName); - const data = { - comment - } - formdata.append("data", JSON.stringify(data)); + formdata.append("title", title); - const response = await axios.post( - `${baseUrl}features/${featureId}/attachments/`, formdata + const response = await axios.put( + `${baseUrl}features/${featureId}/comments/${commentId}/upload-file/`, formdata ); if ( response.status === 200 && diff --git a/src/views/feature/Feature_detail.vue b/src/views/feature/Feature_detail.vue index 371a938cefc4f207adf8a789eb1eec70011c9d21..20b2efdd4c21bf2338c90236bd85e92138ba4685 100644 --- a/src/views/feature/Feature_detail.vue +++ b/src/views/feature/Feature_detail.vue @@ -166,12 +166,9 @@ /> </a> <div class="middle aligned content"> - <a - class="header" - target="_blank" - :href="pj.attachment_file" - >{{ pj.title }}</a - > + <a class="header" target="_blank" :href="pj.attachment_file">{{ + pj.title + }}</a> <div class="description"> {{ pj.info }} </div> @@ -217,7 +214,7 @@ DJANGO_BASE_URL + event.related_comment.attachment.url " - tarrget="_blank" + target="_blank" ><i class="paperclip fitted icon"></i> {{ event.related_comment.attachment.title }}</a > @@ -469,7 +466,8 @@ export default { featureId: this.$route.params.slug_signal, file: this.comment_form.attachment_file.file, fileName: this.comment_form.title.file, - comment: response.data.id, + commentId: response.data.id, + title: response.data.comment, }) .then(() => { this.confirmComment();