mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
accompanying course: fix posting of pinned comment
This commit is contained in:
parent
84f2e1c72a
commit
6d46efa610
@ -203,9 +203,11 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
//console.log('### mutation: toggleConfidential');
|
||||
state.accompanyingCourse.confidential = value;
|
||||
},
|
||||
postFirstComment(state, comment) {
|
||||
//console.log('### mutation: postFirstComment', comment);
|
||||
state.accompanyingCourse.pinnedComment = comment;
|
||||
addPinnedComment(state, value) {
|
||||
state.accompanyingCourse.pinnedComment = value;
|
||||
},
|
||||
removePinnedComment(state, value) {
|
||||
state.accompanyingCourse.pinnedComment = null;
|
||||
},
|
||||
updateSocialIssues(state, value) {
|
||||
console.log('updateSocialIssues', value);
|
||||
@ -337,6 +339,35 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
throw error;
|
||||
})
|
||||
},
|
||||
/**
|
||||
* Add/remove pinnedComment
|
||||
*/
|
||||
removePinnedComment({ commit, dispatch }) {
|
||||
const body = {};
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/comment.json`;
|
||||
|
||||
return makeFetch('DELETE', url, body)
|
||||
.then((response) => {
|
||||
commit('removePinnedComment');
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
throw error;
|
||||
})
|
||||
},
|
||||
addPinnedComment({ commit, dispatch }, payload) {
|
||||
const body = payload ? { type: payload.type, content: payload.content } : {};
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/comment.json`;
|
||||
|
||||
return makeFetch('POST', url, body)
|
||||
.then((response) => {
|
||||
dispatch('patchFirstComment', response);
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
throw error;
|
||||
})
|
||||
},
|
||||
/**
|
||||
* Add/remove/display anonymous requestor
|
||||
*/
|
||||
@ -606,18 +637,23 @@ let initPromise = (root) => Promise.all([getScopesPromise(root), accompanyingCou
|
||||
|
||||
return Promise.all(promises);
|
||||
},
|
||||
postFirstComment({ commit }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`
|
||||
const body = { type: "accompanying_period", pinnedComment: payload }
|
||||
|
||||
patchFirstComment({ commit }, payload) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}.json`;
|
||||
const body = {
|
||||
type: "accompanying_period",
|
||||
pinnedComment: {
|
||||
type: "accompanying_period_comment",
|
||||
id: payload.id
|
||||
}
|
||||
};
|
||||
return makeFetch('PATCH', url, body)
|
||||
.then((response) => {
|
||||
commit('postFirstComment', response.pinnedComment);
|
||||
commit('addPinnedComment', response.pinnedComment);
|
||||
})
|
||||
.catch((error) => {
|
||||
commit('catchError', error);
|
||||
throw error;
|
||||
})
|
||||
});
|
||||
},
|
||||
updateSocialIssues({ state, commit, dispatch }, { payload, body, method }) {
|
||||
const url = `/api/1.0/person/accompanying-course/${id}/socialissue.json`;
|
||||
|
Loading…
x
Reference in New Issue
Block a user