File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed
Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ class App extends Component {
4747 }
4848 componentDidMount ( ) {
4949 this . props . firebase . auth . onAuthStateChanged ( authUser => {
50- console . log ( "Out here!" ) ;
50+ this . setState ( { loading : true } )
51+ console . log ( "Out here!" , this . state . loading ) ;
5152 if ( authUser ) {
5253 console . log ( "In here!" ) ;
5354 this . props . firebase . user ( authUser . uid )
@@ -67,10 +68,12 @@ class App extends Component {
6768 providerData : authUser . providerData ,
6869 ...dbUser ,
6970 } ;
71+ console . log ( "Loading-ul este: " , this . state . loading )
7072 console . log ( this . props . firebase . authUser ) ;
7173 this . setState ( { loading : false } )
7274 } ) ;
7375 } else {
76+ console . log ( "Loading-ul este pe callback: " , this . state . loading )
7477 this . setState ( { loading :false } )
7578 }
7679 } ) ;
Original file line number Diff line number Diff line change @@ -44,7 +44,10 @@ class Firebase {
4444 doSignInWithEmailAndPassword = ( email , password ) =>
4545 this . auth . signInWithEmailAndPassword ( email , password ) ;
4646
47- doSignOut = ( ) => this . auth . signOut ( ) ;
47+ doSignOut = ( ) => {
48+ this . auth . signOut ( ) ;
49+ window . location . reload ( ) ;
50+ }
4851
4952 doPasswordReset = email => this . auth . sendPasswordResetEmail ( email ) ;
5053
Original file line number Diff line number Diff line change @@ -11,7 +11,12 @@ const withAuthorization = condition => Component => {
1111 this . listener = this . props . firebase . auth . onAuthStateChanged (
1212 authUser => {
1313 if ( ! condition ( authUser ) ) {
14+ if ( ! authUser ) {
1415 this . props . history . push ( ROUTES . SIGN_IN ) ;
16+ }
17+ else {
18+ this . props . history . push ( ROUTES . HOME ) ;
19+ }
1520 }
1621 } ,
1722 ) ;
Original file line number Diff line number Diff line change @@ -20,9 +20,11 @@ const link = {
2020
2121
2222const SignOutButton = ( { firebase } ) => (
23- < button style = { icon } type = "button" onClick = { firebase . doSignOut } >
24- < IconSignOut color = 'white' />
23+ < Link to = { ROUTES . SIGN_IN } style = { link } onClick = { firebase . doSignOut } >
24+ < button style = { icon } type = "button" >
25+ < IconSignOut color = 'white' />
2526 </ button >
27+ </ Link >
2628) ;
2729
2830export default withFirebase ( SignOutButton ) ;
You can’t perform that action at this time.
0 commit comments