convert arrow function to normal function javascript online
export const loadUser = () => (dispatch, getState) => {
if (!getState().auth.token) {
dispatch({ type: LOGIN_FAIL });
return;
}
// User Loading
dispatch({ type: USER_LOADING });
axios
.get('/api/auth/user', tokenConfig(getState))
.then(res => {
dispatch({
type: USER_LOADED,
payload: res.data,
});
})
.catch(err => {
console.warn(`Error returned: ${err}.`);
dispatch({
type: AUTH_ERROR,
});
});
};