Unified event name with the API
This commit is contained in:
@ -91,7 +91,7 @@ class Collection extends BaseModel {
|
|||||||
this.updateData(collection);
|
this.updateData(collection);
|
||||||
this.errors = stores.errors;
|
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();
|
if (data.collectionId === this.id) this.fetch();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ class Document extends BaseModel {
|
|||||||
@action delete = async () => {
|
@action delete = async () => {
|
||||||
try {
|
try {
|
||||||
await client.post('/documents.delete', { id: this.id });
|
await client.post('/documents.delete', { id: this.id });
|
||||||
this.emit('document.delete', {
|
this.emit('documents.delete', {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
collectionId: this.collection.id,
|
collectionId: this.collection.id,
|
||||||
});
|
});
|
||||||
|
@ -38,7 +38,7 @@ type Props = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (confirm(msg)) {
|
if (confirm(msg)) {
|
||||||
await this.props.document.delete();
|
await this.props.documents.delete();
|
||||||
this.props.history.push(this.props.document.collection.url);
|
this.props.history.push(this.props.document.collection.url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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);
|
this.remove(data.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user