vsokoltsov

Untitled

Mar 18th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. export const currentUser = () => (dispatch) => {
  2. axios.get('/users/current')
  3. .then((response) => {
  4. dispatch({
  5. type: actionTypes.CURRENT_USER, payload: response.data.current_user,
  6. });
  7. });
  8. };
  9.  
  10. export const signIn = user => (dispatch) => {
  11. axios.post('/authorizations', { ...user })
  12. .then((response) => {
  13. setToken(response.data.token);
  14. dispatch(currentUser());
  15. });
  16. };
Add Comment
Please, Sign In to add comment