diff --git a/skins/base/views/organisms/CreateRoom.js b/skins/base/views/organisms/CreateRoom.js
index e6115f2579..36f6e466e5 100644
--- a/skins/base/views/organisms/CreateRoom.js
+++ b/skins/base/views/organisms/CreateRoom.js
@@ -45,13 +45,29 @@ module.exports = React.createClass({
},
render: function() {
- return (
-
- );
+ var curr_phase = this.state.phase;
+ if (curr_phase == this.phases.CREATING) {
+ return (
+ Creating...
+ );
+ } else {
+ var error_box = "";
+ if (curr_phase == this.phases.ERROR) {
+ error_box = (
+
+ An error occured: {this.state.error_string}
+
+ );
+ }
+ return (
+
+
+
+
+
+ {error_box}
+
+ );
+ }
}
});
diff --git a/src/controllers/organisms/CreateRoom.js b/src/controllers/organisms/CreateRoom.js
index 499585b0e2..f66893d9c7 100644
--- a/src/controllers/organisms/CreateRoom.js
+++ b/src/controllers/organisms/CreateRoom.js
@@ -24,12 +24,26 @@ module.exports = {
onRoomCreated: React.PropTypes.func,
},
+ phases: {
+ CONFIG: "CONFIG",
+ CREATING: "CREATING",
+ CREATED: "CREATED",
+ ERROR: "ERROR",
+ },
+
getDefaultProps: function() {
return {
onRoomCreated: function() {},
};
},
+ getInitialState: function() {
+ return {
+ phase: this.phases.CONFIG,
+ error_string: "",
+ };
+ },
+
onCreateRoom: function() {
var options = {};
@@ -57,8 +71,22 @@ module.exports = {
var deferred = MatrixClientPeg.get().createRoom(options);
- deferred.done(function () {
- this.props.onRoomCreated();
+ this.setState({
+ phase: this.phases.CREATING,
+ });
+
+ var self = this;
+
+ deferred.then(function () {
+ self.setState({
+ phase: self.phases.CREATED,
+ });
+ self.props.onRoomCreated();
+ }, function(err) {
+ self.setState({
+ phase: self.phases.ERROR,
+ error_string: err.toString(),
+ });
});
}
};