after successful registration user should be logged in
This commit is contained in:
@@ -12,24 +12,28 @@ var UserActions = {
|
||||
user: user
|
||||
});
|
||||
|
||||
user.save(null, {
|
||||
success: function() {
|
||||
UserActions.registrationSuccess();
|
||||
},
|
||||
error: function(model, response, options) {
|
||||
UserActions.registrationFailure(response);
|
||||
}
|
||||
});
|
||||
superagent
|
||||
.post(globals.ApiUrl + '/user')
|
||||
.send(user)
|
||||
.withCredentials()
|
||||
.end(function(response){
|
||||
if(response.ok) {
|
||||
UserActions.registrationSuccess(response.body);
|
||||
} else {
|
||||
UserActions.registrationFailure(response.body);
|
||||
}
|
||||
});
|
||||
},
|
||||
registrationSuccess: function() {
|
||||
registrationSuccess: function(user) {
|
||||
AppDispatcher.handleAction({
|
||||
actionType: UserConstants.REGISTRATION_SUCCESS
|
||||
actionType: UserConstants.REGISTRATION_SUCCESS,
|
||||
user: user
|
||||
});
|
||||
},
|
||||
registrationFailure: function(error) {
|
||||
AppDispatcher.handleAction({
|
||||
actionType: UserConstants.REGISTRATION_FAILURE,
|
||||
error: error
|
||||
error: error
|
||||
});
|
||||
},
|
||||
userLogout:function() {
|
||||
|
||||
Reference in New Issue
Block a user