Skip to content

Commit 7709484

Browse files
committed
12-Firebase Realtime Database in React
1 parent 94bb3a9 commit 7709484

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/Firebase/firebase.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import app from 'firebase/app';
22
import 'firebase/auth';
3+
import 'firebase/database';
34

45
const config = {
56
apiKey: process.env.REACT_APP_API_KEY,
@@ -15,6 +16,7 @@ class Firebase {
1516
app.initializeApp(config);
1617

1718
this.auth = app.auth();
19+
this.db = app.database();
1820
}
1921

2022
// *** Auth API ***
@@ -31,6 +33,12 @@ class Firebase {
3133

3234
doPasswordUpdate = password =>
3335
this.auth.currentUser.updatePassword(password);
36+
37+
// *** User API ***
38+
39+
user = uid => this.db.ref(`users/${uid}`);
40+
41+
users = () => this.db.ref('users');
3442
}
3543

3644
export default Firebase;

0 commit comments

Comments
 (0)