This commit is contained in:
Cassie Tarakajian 2016-11-04 17:27:39 -04:00
parent 7ededa5c18
commit 33c7c0ec8f
1 changed files with 4 additions and 15 deletions

View File

@ -25,21 +25,6 @@ export function signUpUser(formValues) {
};
}
// export function loginUser(formValues) {
// return (dispatch) => {
// axios.post(`${ROOT_URL}/login`, formValues, { withCredentials: true })
// .then(response => {
// dispatch({ type: ActionTypes.AUTH_USER,
// user: response.data
// });
// browserHistory.push('/');
// })
// .catch(response => {
// return Promise.reject({ email: response.data.message, _error: 'Login failed!' });
// });
// };
// }
export function loginUser(formValues) {
return axios.post(`${ROOT_URL}/login`, formValues, { withCredentials: true });
}
@ -65,6 +50,10 @@ export function validateAndLoginUser(formProps, dispatch) {
dispatch({ type: ActionTypes.AUTH_USER,
user: response.data
});
dispatch({
type: ActionTypes.SET_PREFERENCES,
preferences: response.data.preferences
});
browserHistory.push('/');
resolve();
})