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>
|
<li>
|
||||||
<write-comment
|
<write-comment
|
||||||
:resource="resource"
|
:resource="resource"
|
||||||
|
@updateComment="updateComment"
|
||||||
></write-comment>
|
></write-comment>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -60,6 +61,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<write-comment
|
<write-comment
|
||||||
:resource="resource"
|
:resource="resource"
|
||||||
|
@updateComment="updateComment"
|
||||||
></write-comment>
|
></write-comment>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -127,6 +129,10 @@ export default {
|
|||||||
this.$toast.open({message: 'An error occurred'})
|
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 {
|
export default {
|
||||||
name: "WriteComment",
|
name: "WriteComment",
|
||||||
props: ['resource'],
|
|
||||||
components: {
|
components: {
|
||||||
Modal,
|
Modal,
|
||||||
ckeditor: CKEditor.component,
|
ckeditor: CKEditor.component,
|
||||||
},
|
},
|
||||||
|
props: ['resource'],
|
||||||
|
emits: ['updateComment'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
modal: {
|
modal: {
|
||||||
@ -99,7 +100,14 @@ export default {
|
|||||||
;
|
;
|
||||||
makeFetch('PATCH', url, body)
|
makeFetch('PATCH', url, body)
|
||||||
.then(r => {
|
.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);
|
//console.log('### mutation: addResource', resource);
|
||||||
state.accompanyingCourse.resources.push(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) {
|
updatePerson(state, payload) {
|
||||||
console.log('### mutation: updatePerson', payload);
|
console.log('### mutation: updatePerson', payload);
|
||||||
let i = null;
|
let i = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user