Connecting modals where needed

This commit is contained in:
Tom Moor
2017-09-11 23:41:12 -07:00
parent cbf87e9dbe
commit 72b10787e5
9 changed files with 25 additions and 22 deletions

View File

@ -88,13 +88,15 @@ class Collection extends BaseModel {
@action delete = async () => {
try {
const res = await client.post('/collections.delete', { id: this.id });
invariant(res && res.data, 'Data should be available');
const { data } = res;
return data.success;
await client.post('/collections.delete', { id: this.id });
this.emit('collections.delete', {
id: this.id,
});
return true;
} catch (e) {
this.errors.add('Collection failed to delete');
}
return false;
};
updateData(data: Object = {}) {