diff --git a/twistter-frontend/src/redux/actions/userActions.js b/twistter-frontend/src/redux/actions/userActions.js index 2177a75..cc6eb56 100644 --- a/twistter-frontend/src/redux/actions/userActions.js +++ b/twistter-frontend/src/redux/actions/userActions.js @@ -1,6 +1,18 @@ import {SET_USER, SET_ERRORS, CLEAR_ERRORS, LOADING_UI} from '../types'; import axios from 'axios'; + +export const getUserData = () => (dispatch) => { + axios.get('/user') + .then((res) => { + dispatch({ + type: SET_USER, + payload: res.data, + }) + }) + .catch((err) => console.error(err)); +} + export const loginUser = (loginData, history) => (dispatch) => { dispatch({ type: LOADING_UI }); axios @@ -21,15 +33,4 @@ export const loginUser = (loginData, history) => (dispatch) => { payload: err.response.data, }) }); -} - -export const getUserData = () => (dispatch) => { - axios.get('/user') - .then((res) => { - dispatch({ - type: SET_USER, - payload: res.data, - }) - }) - .catch((err) => console.error(err)); } \ No newline at end of file