Skip to content
Snippets Groups Projects
Commit 7a32aaf0 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

adapt comment post to new endpoint & fix attachment target typo

parent db8cd589
No related branches found
No related tags found
No related merge requests found
......@@ -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 &&
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment