accompanying course comment: more tentative to delete the comment

This commit is contained in:
nobohan 2022-03-04 14:22:25 +01:00
parent f04118218d
commit 6472c554ed
3 changed files with 5 additions and 3 deletions

View File

@ -261,6 +261,7 @@ class AccompanyingPeriod implements
* cascade={"persist"}, * cascade={"persist"},
* ) * )
* @Groups({"read"}) * @Groups({"read"})
* @ORM\JoinColumn(onDelete="SET NULL")
*/ */
private ?Comment $pinnedComment = null; private ?Comment $pinnedComment = null;

View File

@ -107,7 +107,7 @@ export default {
} }
}, },
removeComment() { removeComment() {
this.$store.dispatch('removePinnedComment', {}) this.$store.dispatch('removePinnedComment', {id: this.pinnedComment.id})
.catch(({name, violations}) => { .catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') { if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation})); violations.forEach((violation) => this.$toast.open({message: violation}));

View File

@ -342,8 +342,9 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
/** /**
* Add/remove pinnedComment * Add/remove pinnedComment
*/ */
removePinnedComment({ commit }) { //DOES NOT WORK removePinnedComment({ commit }, payload) { //DOES NOT WORK
const body = {type: "accompanying_period_comment"};
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`;
return makeFetch('DELETE', url, body) return makeFetch('DELETE', url, body)