Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as types from '../constants/UserTypes'
- import {ajaxRequest} from './BaseAction'
- const createUser = userData => {
- let data = {
- firstname: userData.firstName,
- lastname: userData.lastName,
- email: userData.email,
- password: userData.password,
- login: userData.login,
- birthday: userData.birthday,
- phone: userData.phone
- }
- return dispatch => {
- console.log(data);
- return ajaxRequest('POST', '/register', data, false, {
- 201: () => {
- dispatch({
- type: types.CREATE_USER
- })
- },
- 422: data => {
- dispatch({
- type: types.CREATE_USER_FAIL,
- error: JSON.parse(data.data.responseText)
- })
- }
- })
- }
- }
- export {createUser}
Add Comment
Please, Sign In to add comment