@@ -26,15 +26,15 @@ class Example extends React.Component {
26
26
}
27
27
28
28
componentDidMount () {
29
- this .unsubscribe = firebase .auth ().onAuthStateChanged (function (user ) {
29
+ this .unsubscribe = firebase .auth ().onAuthStateChanged ((user ) => {
30
30
if (user) {
31
31
// User is signed in.
32
32
}
33
33
});
34
34
}
35
35
36
36
componentWillUnmount () {
37
- if (this .listener ) {
37
+ if (this .unsubscribe ) {
38
38
this .unsubscribe ();
39
39
}
40
40
}
@@ -48,7 +48,7 @@ We can create a user by calling the `createUserWithEmailAndPassword()` function.
48
48
The method accepts two parameters, an email and a password.
49
49
50
50
``` javascript
51
- firestack .auth ().createUserWithEmailAndPassword (' ari@fullstack.io ' , ' 123456' )
51
+ firestack .auth ().createUserWithEmailAndPassword (' foo@bar.com ' , ' 123456' )
52
52
.then ((user ) => {
53
53
console .log (' user created' , user)
54
54
})
@@ -63,7 +63,7 @@ To sign a user in with their email and password, use the `signInWithEmailAndPass
63
63
It accepts two parameters, the user's email and password:
64
64
65
65
``` javascript
66
- firestack .auth ().signInWithEmailAndPassword (' ari@fullstack.io ' , ' 123456' )
66
+ firestack .auth ().signInWithEmailAndPassword (' foo@bar.com ' , ' 123456' )
67
67
.then ((user ) => {
68
68
console .log (' User successfully logged in' , user)
69
69
})
@@ -111,7 +111,7 @@ firestack.auth().signInWithCredential(credential)
111
111
})
112
112
.catch ((err ) => {
113
113
console .error (' User signin error' , err);
114
- })
114
+ });
115
115
```
116
116
117
117
#### [ ` signInWithCustomToken(token: string): Promise ` ] ( https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithCustomToken )
0 commit comments