Refresh session, close popup after registration

This commit is contained in:
Ray Schamp 2015-10-09 09:52:36 -06:00
parent 6b1ce8549e
commit fcec859cbe
2 changed files with 18 additions and 2 deletions

View file

@ -96,6 +96,10 @@ var Navigation = React.createClass({
closeRegistration: function () {
this.setState({'registrationOpen': false});
},
completeRegistration: function () {
window.refreshSession();
this.closeRegistration();
},
render: function () {
var classes = classNames({
'inner': true,
@ -151,7 +155,8 @@ var Navigation = React.createClass({
<Registration
key="registration"
isOpen={this.state.registrationOpen}
onRequestClose={this.closeRegistration} />,
onRequestClose={this.closeRegistration}
onRegistrationDone={this.completeRegistration} />,
<li className="link right login-item" key="login">
<a
href="#"

View file

@ -7,9 +7,20 @@ Modal.setAppElement(document.getElementById('view'));
module.exports = React.createClass({
propTypes: {
isOpen: React.PropTypes.func,
isOpen: React.PropTypes.bool,
onRegistrationDone: React.PropTypes.func,
onRequestClose: React.PropTypes.func
},
onMessage: function (e) {
if (e.origin != window.location.origin) return;
if (e.data == 'registration-done') this.props.onRegistrationDone();
},
componentDidMount: function () {
window.addEventListener('message', this.onMessage);
},
componentWillUnmount: function () {
window.removeEventListener('message', this.onMessage);
},
render: function () {
return (
<Modal