accompanyiing period comment: fix removing of comment

This commit is contained in:
nobohan 2022-03-10 17:01:52 +01:00
parent 16a0dc4621
commit ded2ac7d48
2 changed files with 8 additions and 8 deletions

View File

@ -29,7 +29,7 @@
}} }}
</div> </div>
<!-- <div> //DOES NOT WORk <div>
<ul class="record_actions"> <ul class="record_actions">
<li v-if="pinnedComment !== null"> <li v-if="pinnedComment !== null">
<a class="btn btn-delete" <a class="btn btn-delete"
@ -38,7 +38,7 @@
</a> </a>
</li> </li>
</ul> </ul>
</div> --> </div>
</form> </form>
</div> </div>
@ -49,6 +49,7 @@
<script> <script>
import CKEditor from '@ckeditor/ckeditor5-vue'; import CKEditor from '@ckeditor/ckeditor5-vue';
import ClassicEditor from "ChillMainAssets/module/ckeditor5"; import ClassicEditor from "ChillMainAssets/module/ckeditor5";
import { mapState } from "vuex";
export default { export default {
name: "Comment", name: "Comment",
@ -65,15 +66,15 @@ export default {
} }
}, },
computed: { computed: {
pinnedComment() { ...mapState({
return this.$store.state.accompanyingCourse.pinnedComment; pinnedComment: state => state.accompanyingCourse.pinnedComment,
}, }),
content: { content: {
set(value) { set(value) {
this.formData.content = value; this.formData.content = value;
}, },
get() { get() {
return (this.pinnedComment)? this.pinnedComment.content : {}; return this.pinnedComment ? this.pinnedComment.content : '';
} }
}, },
errors() { errors() {

View File

@ -342,8 +342,7 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
/** /**
* Add/remove pinnedComment * Add/remove pinnedComment
*/ */
removePinnedComment({ commit }, payload) { //DOES NOT WORK removePinnedComment({ commit }, payload) {
const body = {type: "accompanying_period_comment", id: payload.id}; const body = {type: "accompanying_period_comment", id: payload.id};
const url = `/api/1.0/person/accompanying-course/${id}/comment.json`; const url = `/api/1.0/person/accompanying-course/${id}/comment.json`;