Skip to content

Instantly share code, notes, and snippets.

@thidasapankaja
Created July 17, 2018 04:20
Show Gist options
  • Save thidasapankaja/aba4dbdaa579099cfed18d309c4180c4 to your computer and use it in GitHub Desktop.
Save thidasapankaja/aba4dbdaa579099cfed18d309c4180c4 to your computer and use it in GitHub Desktop.
Action Creator for Signup
import * as types from '../constants/action_types';
import axios from 'axios';
export const signup = (user) => {
console.log(user);
return async dispatch => {
try {
const response = await axios.get('http://localhost:5000/api/user/register', user)
const data = {response}
dispatch({
type : types.SIGN_UP,
payload : data.fromback
})
} catch (error) {
console.lot(error)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment