Skip to content

Instantly share code, notes, and snippets.

@MrRoyce
Last active July 23, 2016 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrRoyce/9228884d8910d990d739f1f0dae03842 to your computer and use it in GitHub Desktop.
Save MrRoyce/9228884d8910d990d739f1f0dae03842 to your computer and use it in GitHub Desktop.
React/Redux code to login a user with axios - Issue with zombie.js testing
// Login the user
export const getUserLogin = (email, password) => {
let
url = `${GT_API_URL}/login`
;
console.log('getUserLogin'); // This text appears on the log
return function (dispatch) {
dispatch(userLoginRequest());
return axios({
url : url,
timeout : 20000,
method : 'post',
responseType : 'json',
data : {
email : email,
password : password
}
})
.then(
response => {
console.log('success for user login response'); // This log does not appear
dispatch(userLoginSuccess(response)); // Store it in the state
},
error => {
console.log('fail to login user'); // Neither does this one
dispatch(userLoginFailure());
// Track the error
piwik.trackError( { message: error, filename: 'userAction', lineno: 229 }, 'User Login Error');
}
)
;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment