Guest User

Untitled

a guest
Nov 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import {createRequestTypes, action} from '../../../common/action';
  2.  
  3. export const AUTH_LOGIN = createRequestTypes('AUTH_LOGIN');
  4.  
  5. // At this point AUTH_LOGIN is an object like:
  6. // AUTHLOGIN: {
  7. // FAILED: "AUTH_LOGIN_FAILED",
  8. // REQUESTED: "AUTH_LOGIN_REQUESTED",
  9. // SUCCEEDED: "AUTH_LOGIN_SUCCEEDED"
  10. // }
  11. // Hence we can just reference using AUTHLOGIN.FAILED, rather than AUTHLOGIN[a.FAILED]
  12.  
  13. export const login = {
  14. request: ({ errorMessages, ...credentials }) => action(AUTH_LOGIN.REQUEST, credentials),
  15. success: token => action(AUTH_LOGIN.SUCCESS, { token }),
  16. failure: error => action(AUTH_LOGIN.FAILURE, error)
  17. };
Add Comment
Please, Sign In to add comment