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