Skip to content
New issue

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

Ht1 #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Ht1 #3

wants to merge 3 commits into from

Conversation

al-mighty
Copy link

No description provided.

return <Component {...props} />;
}

return <Redirect to="/auth"/>;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Может Redirect не лучший выбор в данном случае, так ты будешь всегда сначала на auth попадать

@@ -27,7 +28,15 @@ export default function reducer(state = new ReducerRecord(), action) {
switch (type) {
case SIGN_IN_SUCCESS:
case SIGN_UP_SUCCESS:
return state.set('user', payload.user)
case START_SESSION:
localStorage.setItem('token', payload.user.email)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в редюсере сайдэффекты делать - плохая практика

} else if (localStorage.getItem('token') !== undefined) {
const user = localStorage.getItem('token');
console.log(user);
dispatch({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если уже хочешь заморачиваться с токенами - их тоже инвалидировать надо иногда

@al-mighty
Copy link
Author

al-mighty commented Feb 11, 2019 via email

@al-mighty
Copy link
Author

al-mighty commented Feb 11, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants