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 #6

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

Ht1 #6

wants to merge 2 commits into from

Conversation

niksavkin
Copy link

No description provided.


class AuthProvider extends React.Component {
render() {
return <AuthContext.Provider value={{user: this.props.auth && this.props.auth.user}}>
Copy link
Owner

Choose a reason for hiding this comment

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

Ок, но не вижу смысла держать в отдельном контексте, если уже есть редакс

user
? <Component {...props} />
: <Redirect to="/auth/sign-in" />
}
Copy link
Owner

Choose a reason for hiding this comment

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

Это очень плохо читается, вынеси в отдельный метод

type: SIGN_IN_START
});

firebase.auth().onAuthStateChanged((user) => {

Choose a reason for hiding this comment

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

Есть подозрение, что без перелогина второй раз checkAuth повесит приложение в SIGN_IN_START.
https://firebase.google.com/docs/reference/js/firebase.auth.Auth#onAuthStateChanged

The observer will be triggered in the following scenarios:

When auth().onAuthStateChanged() is first called. It will trigger with the initial Auth state. If the user is returning from an auth().signInWithRedirect() operation, the observer will wait for that operation to resolve before initially triggering.
When a new user signs.
When an already signed in user signs out.

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