From aa61c37442a8e635743ab771a17e4898f63ffe05 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 11 Jan 2020 13:54:49 -0800 Subject: [PATCH] fix: View does not appear for first ever view closes #1152 --- app/models/Document.js | 4 ++-- app/stores/ViewsStore.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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);