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 {
async rebuildStructure() {
// compute order of structural elements once more
await this.buildStructure();
console.debug("built structure")
// throw away stale cache
this.invalidateStructureCache();
......
......@@ -317,14 +317,16 @@ export const actions = {
// console.log(resp);
});
},
copyStructuralElement({ dispatch, getters }, { parentId, element }) {
async copyStructuralElement({ dispatch, getters, rootGetters }, { parentId, element }) {
const copy = { data: { parent_id: parentId, }, };
return state.httpClient.post(`courseware-structural-elements/${element.id}/copy`, copy)
.then(({ data }) => {
const id = data.data.id;
dispatch('loadStructuralElement', id);
});
const result = await state.httpClient.post(`courseware-structural-elements/${element.id}/copy`, copy);
const id = result.data.data.id;
await dispatch('loadStructuralElement', id);
const newElement = rootGetters['courseware-structural-elements/byId']({ id });
return dispatch('courseware-structure/loadDescendants', { root: newElement });
},
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