-
Notifications
You must be signed in to change notification settings - Fork 13
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
base: master
Are you sure you want to change the base?
Ht1 #6
Conversation
|
||
class AuthProvider extends React.Component { | ||
render() { | ||
return <AuthContext.Provider value={{user: this.props.auth && this.props.auth.user}}> |
There was a problem hiding this comment.
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" /> | ||
} |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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.
No description provided.