Add onRoomCreated callback to CreateRoom organism

pull/1/head
Erik Johnston 2015-07-14 17:01:06 +01:00
parent a748c090fb
commit 03b715b8bf
1 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,16 @@ var React = require("react");
var MatrixClientPeg = require("../../MatrixClientPeg"); var MatrixClientPeg = require("../../MatrixClientPeg");
module.exports = { module.exports = {
propTypes: {
onRoomCreated: React.PropTypes.func,
},
getDefaultProps: function() {
return {
onRoomCreated: function() {},
};
},
onCreateRoom: function() { onCreateRoom: function() {
var options = {}; var options = {};
@ -46,5 +56,9 @@ module.exports = {
} }
var deferred = MatrixClientPeg.get().createRoom(options); var deferred = MatrixClientPeg.get().createRoom(options);
deferred.done(function () {
this.props.onRoomCreated();
});
} }
}; };