mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
fix initialComment with patch endpoint
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
{{ errors[0] }}
|
||||
</div>
|
||||
|
||||
<div v-if="firstComment">
|
||||
créé par {{ firstComment.creator.text }}
|
||||
le {{ $d(firstComment.createdAt.datetime, 'long') }}
|
||||
<div v-if="firstComment.updatedAt.datetime !== firstComment.createdAt.datetime">
|
||||
modifié par {{ firstComment.updatedBy.text }}
|
||||
le {{ $d(firstComment.updatedAt.datetime, 'long') }}
|
||||
<div v-if="initialComment">
|
||||
créé par {{ initialComment.creator.text }}
|
||||
le {{ $d(initialComment.createdAt.datetime, 'long') }}
|
||||
<div v-if="initialComment.updatedAt.datetime !== initialComment.createdAt.datetime">
|
||||
modifié par {{ initialComment.updatedBy.text }}
|
||||
le {{ $d(initialComment.updatedAt.datetime, 'long') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,9 +28,17 @@
|
||||
<li>
|
||||
<button type="submit" class="sc-button bt-save">{{ $t('action.save') }}</button>
|
||||
</li>
|
||||
<li id="xyz">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
<button
|
||||
class="sc-button bt-delete"
|
||||
@click="removeComment">
|
||||
{{ $t('action.delete') }}
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -40,23 +48,21 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
formdata: {
|
||||
type: "accompanying_period_comment",
|
||||
content: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
comments() {
|
||||
return this.$store.state.accompanyingCourse.comments;
|
||||
},
|
||||
firstComment() {
|
||||
return this.comments[0];
|
||||
initialComment() {
|
||||
return this.$store.state.accompanyingCourse.initialComment;
|
||||
},
|
||||
content: {
|
||||
set(value) {
|
||||
this.formdata.content = value;
|
||||
},
|
||||
get() {
|
||||
return (this.comments.length > 0) ? this.comments[0].content : null ;
|
||||
return (this.initialComment)? this.initialComment.content : null;
|
||||
}
|
||||
},
|
||||
errors() {
|
||||
@@ -65,8 +71,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
submitform() {
|
||||
this.formdata['method'] = (!this.firstComment)? 'POST' : 'PATCH';
|
||||
console.log('submit');
|
||||
this.$store.dispatch('postFirstComment', this.formdata);
|
||||
},
|
||||
removeComment() {
|
||||
console.log('remove');
|
||||
this.$store.dispatch('postFirstComment', null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user