From 8b7f737c975b75261b291ff85c51612395db68a2 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Mon, 23 Oct 2017 23:47:37 +0100 Subject: [PATCH] Remove logging. Return early. --- src/components/views/elements/AppTile.js | 26 +++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 97957586ca..744f51ed42 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -183,21 +183,19 @@ export default React.createClass({ , button: _t("Delete widget"), onFinished: (confirmed) => { - if (confirmed) { - console.log("Delete widget %s", this.props.id); - this.setState({deleting: true}); - MatrixClientPeg.get().sendStateEvent( - this.props.room.roomId, - 'im.vector.modular.widgets', - {}, // empty content - this.props.id, - ).then(() => { - console.log('Deleted widget'); - }, (e) => { - console.error('Failed to delete widget', e); - this.setState({deleting: false}); - }); + if (!confirmed) { + return; } + this.setState({deleting: true}); + MatrixClientPeg.get().sendStateEvent( + this.props.room.roomId, + 'im.vector.modular.widgets', + {}, // empty content + this.props.id, + ).catch((e) => { + console.error('Failed to delete widget', e); + this.setState({deleting: false}); + }); }, }); } else {