Skip to content
Snippets Groups Projects
Commit 4c51bfe2 authored by Marcus Eibrink-Lunzenauer's avatar Marcus Eibrink-Lunzenauer
Browse files

Load copied subtree not just the new subtree*s root element.

Fixes #454.
parent 994f6603
No related branches found
No related tags found
No related merge requests found
...@@ -23,7 +23,6 @@ export default { ...@@ -23,7 +23,6 @@ export default {
async rebuildStructure() { async rebuildStructure() {
// compute order of structural elements once more // compute order of structural elements once more
await this.buildStructure(); await this.buildStructure();
console.debug("built structure")
// throw away stale cache // throw away stale cache
this.invalidateStructureCache(); this.invalidateStructureCache();
......
...@@ -317,14 +317,16 @@ export const actions = { ...@@ -317,14 +317,16 @@ export const actions = {
// console.log(resp); // console.log(resp);
}); });
}, },
copyStructuralElement({ dispatch, getters }, { parentId, element }) { async copyStructuralElement({ dispatch, getters, rootGetters }, { parentId, element }) {
const copy = { data: { parent_id: parentId, }, }; const copy = { data: { parent_id: parentId, }, };
return state.httpClient.post(`courseware-structural-elements/${element.id}/copy`, copy) const result = await state.httpClient.post(`courseware-structural-elements/${element.id}/copy`, copy);
.then(({ data }) => { const id = result.data.data.id;
const id = data.data.id; await dispatch('loadStructuralElement', id);
dispatch('loadStructuralElement', id);
}); const newElement = rootGetters['courseware-structural-elements/byId']({ id });
return dispatch('courseware-structure/loadDescendants', { root: newElement });
}, },
lockObject({ dispatch, getters }, { id, type }) { lockObject({ dispatch, getters }, { id, type }) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment