Skip to content

Commit 15bd343

Browse files
authored
Update authentication.md
1 parent 42bdbfb commit 15bd343

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/api/authentication.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ class Example extends React.Component {
2626
}
2727

2828
componentDidMount() {
29-
this.unsubscribe = firebase.auth().onAuthStateChanged(function(user) {
29+
this.unsubscribe = firebase.auth().onAuthStateChanged((user) => {
3030
if (user) {
3131
// User is signed in.
3232
}
3333
});
3434
}
3535

3636
componentWillUnmount() {
37-
if (this.listener) {
37+
if (this.unsubscribe) {
3838
this.unsubscribe();
3939
}
4040
}
@@ -48,7 +48,7 @@ We can create a user by calling the `createUserWithEmailAndPassword()` function.
4848
The method accepts two parameters, an email and a password.
4949

5050
```javascript
51-
firestack.auth().createUserWithEmailAndPassword('ari@fullstack.io', '123456')
51+
firestack.auth().createUserWithEmailAndPassword('foo@bar.com', '123456')
5252
.then((user) => {
5353
console.log('user created', user)
5454
})
@@ -63,7 +63,7 @@ To sign a user in with their email and password, use the `signInWithEmailAndPass
6363
It accepts two parameters, the user's email and password:
6464

6565
```javascript
66-
firestack.auth().signInWithEmailAndPassword('ari@fullstack.io', '123456')
66+
firestack.auth().signInWithEmailAndPassword('foo@bar.com', '123456')
6767
.then((user) => {
6868
console.log('User successfully logged in', user)
6969
})
@@ -111,7 +111,7 @@ firestack.auth().signInWithCredential(credential)
111111
})
112112
.catch((err) => {
113113
console.error('User signin error', err);
114-
})
114+
});
115115
```
116116

117117
#### [`signInWithCustomToken(token: string): Promise`](https://firebase.google.com/docs/reference/js/firebase.auth.Auth#signInWithCustomToken)

0 commit comments

Comments
 (0)