Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. // Login the user
  2. export const getUserLogin = (email, password) => {
  3. let
  4. url = `${GT_API_URL}/login`
  5. ;
  6.  
  7. console.log('getUserLogin');
  8.  
  9. return function (dispatch) {
  10. dispatch(userLoginRequest());
  11.  
  12. return axios({
  13. url : url,
  14. timeout : 20000,
  15. method : 'post',
  16. responseType : 'json',
  17. data : {
  18. email : email,
  19. password : password
  20. }
  21. })
  22. .then(
  23. response => {
  24. console.log('success for user login response');
  25. dispatch(userLoginSuccess(response)); // Store it in the state
  26. },
  27. error => {
  28. console.log('fail to login user');
  29. dispatch(userLoginFailure());
  30. // Track the error
  31. piwik.trackError( { message: error, filename: 'userAction', lineno: 229 }, 'User Login Error');
  32. }
  33. )
  34. ;
  35. };
  36.  
  37. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement