Added API to update document tree

This commit is contained in:
Jori Lallo
2016-06-25 22:27:44 -07:00
parent 7ea6eb5d28
commit a0649e6fd3
11 changed files with 182 additions and 30 deletions

View File

@@ -11,8 +11,8 @@ const store = new class DocumentSceneStore {
/* Computed */
@computed get isAtlas() {
console.log(this.document.atlas.type)
return this.document.atlas.type === 'atlas';
return this.document &&
this.document.atlas.type === 'atlas';
}
/* Actions */
@@ -42,6 +42,20 @@ const store = new class DocumentSceneStore {
}
this.isFetching = false;
}
@action updateNavigationTree = async (tree) => {
this.isFetching = true;
try {
const res = await client.post('/atlases.updateNavigationTree', {
id: this.document.atlas.id,
tree: tree,
});
} catch (e) {
console.error("Something went wrong");
}
this.isFetching = false;
}
}();
export default store;