From ed1cb44deb95db1104753798b017393d848476cf Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 22 Jul 2015 13:39:36 +0100 Subject: [PATCH] Show Loader while leaving --- src/Modal.js | 2 ++ src/controllers/molecules/MemberTile.js | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Modal.js b/src/Modal.js index a8331e55..1e3ded42 100644 --- a/src/Modal.js +++ b/src/Modal.js @@ -56,5 +56,7 @@ module.exports = { ); React.render(dialog, this.getOrCreateContainer()); + + return {close: closeDialog}; }, }; diff --git a/src/controllers/molecules/MemberTile.js b/src/controllers/molecules/MemberTile.js index 20ace568..5d1f99a6 100644 --- a/src/controllers/molecules/MemberTile.js +++ b/src/controllers/molecules/MemberTile.js @@ -17,6 +17,8 @@ limitations under the License. 'use strict'; var dis = require("../../dispatcher"); +var Modal = require("../../Modal"); +var Loader = require("react-loader"); var MatrixClientPeg = require("../../MatrixClientPeg"); @@ -30,12 +32,14 @@ module.exports = { onLeaveClick: function() { var d = MatrixClientPeg.get().leave(this.props.member.roomId); - // TODO: Add spinner + + var modal = Modal.createDialog(Loader); d.then(function() { - // TODO: Change to another room. + modal.close(); dis.dispatch({action: 'view_next_room'}); }, function(err) { + modal.close(); Modal.createDialog(ErrorDialog, { title: "Failed to leave room", description: err.toString()