Skip to content

Conversation

@niksavkin
Copy link

No description provided.

Nikita Savkin added 2 commits February 4, 2019 19:49

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