diff --git a/app/models/Document.js b/app/models/Document.js index a31412940..4683b8772 100644 --- a/app/models/Document.js +++ b/app/models/Document.js @@ -158,8 +158,8 @@ export default class Document extends BaseModel { }; @action - view = async () => { - await client.post('/views.create', { documentId: this.id }); + view = () => { + return this.store.rootStore.views.create({ documentId: this.id }); }; @action diff --git a/app/stores/ViewsStore.js b/app/stores/ViewsStore.js index a7f4d60a9..cb7e27d92 100644 --- a/app/stores/ViewsStore.js +++ b/app/stores/ViewsStore.js @@ -5,7 +5,7 @@ import RootStore from './RootStore'; import View from 'models/View'; export default class ViewsStore extends BaseStore { - actions = ['list']; + actions = ['list', 'create']; constructor(rootStore: RootStore) { super(rootStore, View);