We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export function loginUser({ email, password }) { return function (dispatch) { axios.post(`${API_URL}/auth/login`, { email, password }) .then((response) => { cookie.save('token', response.data.token, { path: '/' }); cookie.save('user', response.data.user, { path: '/' }); dispatch({ type: AUTH_USER }); window.location.href = `${CLIENT_ROOT_URL}/dashboard`; }) .catch((error) => { errorHandler(dispatch, error.response, AUTH_ERROR); }); }; }
above is login action in auth.js(client----src----actions----auth.js).
If use window.location.href, the page would refresh, redux state would lose, you would always get authenticated state false!
Replace window.location.href with browserHistory, state would be ok!
import { browserHistory } from 'react-router' browserHistory.push('/some/path')
@joshuaslate
The text was updated successfully, but these errors were encountered:
No branches or pull requests
above is login action in auth.js(client----src----actions----auth.js).
If use window.location.href, the page would refresh, redux state would lose, you would always get authenticated state false!
Replace window.location.href with browserHistory, state would be ok!
@joshuaslate
The text was updated successfully, but these errors were encountered: