Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {createRequestTypes, action} from '../../../common/action';
- export const AUTH_LOGIN = createRequestTypes('AUTH_LOGIN');
- // At this point AUTH_LOGIN is an object like:
- // AUTHLOGIN: {
- // FAILED: "AUTH_LOGIN_FAILED",
- // REQUESTED: "AUTH_LOGIN_REQUESTED",
- // SUCCEEDED: "AUTH_LOGIN_SUCCEEDED"
- // }
- // Hence we can just reference using AUTHLOGIN.FAILED, rather than AUTHLOGIN[a.FAILED]
- export const login = {
- request: ({ errorMessages, ...credentials }) => action(AUTH_LOGIN.REQUEST, credentials),
- success: token => action(AUTH_LOGIN.SUCCESS, { token }),
- failure: error => action(AUTH_LOGIN.FAILURE, error)
- };
Add Comment
Please, Sign In to add comment