mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
fix initialComment with patch endpoint
This commit is contained in:
@@ -4,8 +4,7 @@ import { getAccompanyingCourse,
|
||||
patchAccompanyingCourse,
|
||||
postParticipation,
|
||||
postRequestor,
|
||||
postResource,
|
||||
postComment } from '../api';
|
||||
postResource } from '../api';
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
const id = window.accompanyingCourseId;
|
||||
@@ -74,7 +73,8 @@ let initPromise = getAccompanyingCourse(id)
|
||||
state.accompanyingCourse.confidential = value;
|
||||
},
|
||||
postFirstComment(state, comment) {
|
||||
state.accompanyingCourse.comments.push(comment);
|
||||
console.log('### mutation: postFirstComment', comment);
|
||||
state.accompanyingCourse.initialComment = comment;
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
@@ -162,9 +162,10 @@ let initPromise = getAccompanyingCourse(id)
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
},
|
||||
postFirstComment({ commit }, payload) {
|
||||
postComment(id, payload)
|
||||
.then(comment => new Promise((resolve, reject) => {
|
||||
commit('postFirstComment', comment);
|
||||
console.log('## action: postFirstComment: payload', payload);
|
||||
patchAccompanyingCourse(id, { type: "accompanying_period", initialComment: payload })
|
||||
.then(course => new Promise((resolve, reject) => {
|
||||
commit('postFirstComment', course.initialComment);
|
||||
resolve();
|
||||
})).catch((error) => { commit('catchError', error) });
|
||||
}
|
||||
|
Reference in New Issue
Block a user