after successful registration user should be logged in

This commit is contained in:
Edin Dazdarevic
2015-03-03 22:19:41 +01:00
parent 9ebb4769af
commit 38de717da9
5 changed files with 26 additions and 18 deletions

View File

@@ -10,8 +10,8 @@ var LoginStatus = React.createClass({
return UserStore.getLoginState();
},
componentDidMount: function() {
UserActions.checkLogin();
UserStore.addChangeListener(this.onUserStateChange);
UserActions.checkLogin();
},
componentWillReceiveProps: function() {
this.update();
@@ -23,7 +23,9 @@ var LoginStatus = React.createClass({
this.update();
},
update: function() {
this.setState(UserStore.getLoginState());
if(this.isMounted()) {
this.setState(UserStore.getLoginState());
}
},
logout: function(e){
e.preventDefault();