mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
emit response and commit change in store
This commit is contained in:
parent
abcc8557ce
commit
34ff91979b
@ -17,6 +17,7 @@
|
||||
<li>
|
||||
<write-comment
|
||||
:resource="resource"
|
||||
@updateComment="updateComment"
|
||||
></write-comment>
|
||||
</li>
|
||||
<li>
|
||||
@ -60,6 +61,7 @@
|
||||
<li>
|
||||
<write-comment
|
||||
:resource="resource"
|
||||
@updateComment="updateComment"
|
||||
></write-comment>
|
||||
</li>
|
||||
<li>
|
||||
@ -127,6 +129,10 @@ export default {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
});
|
||||
},
|
||||
updateComment(resource) {
|
||||
console.log('updateComment', resource);
|
||||
this.$store.commit('updateResource', resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,11 +45,12 @@ import ClassicEditor from "ChillMainAssets/module/ckeditor5";
|
||||
|
||||
export default {
|
||||
name: "WriteComment",
|
||||
props: ['resource'],
|
||||
components: {
|
||||
Modal,
|
||||
ckeditor: CKEditor.component,
|
||||
},
|
||||
props: ['resource'],
|
||||
emits: ['updateComment'],
|
||||
data() {
|
||||
return {
|
||||
modal: {
|
||||
@ -99,7 +100,14 @@ export default {
|
||||
;
|
||||
makeFetch('PATCH', url, body)
|
||||
.then(r => {
|
||||
this.modal.showModal = false
|
||||
let resource = {
|
||||
'type': 'accompanying_period_resource',
|
||||
'id': r.id,
|
||||
'comment': r.comment,
|
||||
'resource': r.resource
|
||||
}
|
||||
this.$emit('updateComment', resource);
|
||||
this.modal.showModal = false;
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -124,6 +124,11 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise])
|
||||
//console.log('### mutation: addResource', resource);
|
||||
state.accompanyingCourse.resources.push(resource);
|
||||
},
|
||||
updateResource(state, payload) {
|
||||
console.log('### mutation: updateResource', payload);
|
||||
let i = state.accompanyingCourse.resources.findIndex(r => r.id === payload.id);
|
||||
state.accompanyingCourse.resources[i] = payload;
|
||||
},
|
||||
updatePerson(state, payload) {
|
||||
console.log('### mutation: updatePerson', payload);
|
||||
let i = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user