fix #187
This commit is contained in:
parent
7ededa5c18
commit
33c7c0ec8f
1 changed files with 4 additions and 15 deletions
|
@ -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();
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue