From a1b239003cd3c15e5925289b015e1c52f97b2692 Mon Sep 17 00:00:00 2001 From: Jori Lallo Date: Mon, 28 Aug 2017 23:50:45 -0700 Subject: [PATCH] Unified event name with the API --- frontend/models/Collection.js | 2 +- frontend/models/Document.js | 2 +- frontend/scenes/Document/components/Menu.js | 2 +- frontend/stores/DocumentsStore.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/models/Collection.js b/frontend/models/Collection.js index f6d021de..65ac1e1a 100644 --- a/frontend/models/Collection.js +++ b/frontend/models/Collection.js @@ -91,7 +91,7 @@ class Collection extends BaseModel { this.updateData(collection); this.errors = stores.errors; - this.on('document.delete', (data: { collectionId: string }) => { + this.on('documents.delete', (data: { collectionId: string }) => { if (data.collectionId === this.id) this.fetch(); }); } diff --git a/frontend/models/Document.js b/frontend/models/Document.js index ae30a5b3..82acf88e 100644 --- a/frontend/models/Document.js +++ b/frontend/models/Document.js @@ -173,7 +173,7 @@ class Document extends BaseModel { @action delete = async () => { try { await client.post('/documents.delete', { id: this.id }); - this.emit('document.delete', { + this.emit('documents.delete', { id: this.id, collectionId: this.collection.id, }); diff --git a/frontend/scenes/Document/components/Menu.js b/frontend/scenes/Document/components/Menu.js index ae315d82..7732f3c6 100644 --- a/frontend/scenes/Document/components/Menu.js +++ b/frontend/scenes/Document/components/Menu.js @@ -38,7 +38,7 @@ type Props = { } if (confirm(msg)) { - await this.props.document.delete(); + await this.props.documents.delete(); this.props.history.push(this.props.document.collection.url); } }; diff --git a/frontend/stores/DocumentsStore.js b/frontend/stores/DocumentsStore.js index d79ce66c..473d9b1d 100644 --- a/frontend/stores/DocumentsStore.js +++ b/frontend/stores/DocumentsStore.js @@ -134,7 +134,7 @@ class DocumentsStore extends BaseStore { } }); - this.on('document.delete', (data: { id: string }) => { + this.on('documents.delete', (data: { id: string }) => { this.remove(data.id); });