-
Notifications
You must be signed in to change notification settings - Fork 1
/
Fire.js
37 lines (30 loc) · 778 Bytes
/
Fire.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import firebase from 'firebase';
class Fire {
constructor() {
this.init();
}
init = () => {
if (!firebase.apps.length) {
firebase.initializeApp({
apiKey: 'AIzaSyDtPLoNbRrgrLGQ4SXCcnqB3Rfd6KYl1a8',
authDomain: 'chatmodule-app.firebaseapp.com',
databaseURL: 'https://chatmodule-app.firebaseio.com',
projectId: 'chatmodule-app',
storageBucket: 'chatmodule-app.appspot.com',
messagingSenderId: '54472305059',
appId: '1:54472305059:web:f1d2c27cf6a86df74ad216',
measurementId: 'G-WSGE135M2R',
});
}
};
get = (callback) => {
this.db.on('child_added', (snapshot) => callback(this.parse(snapshot)));
};
off() {
this.db.off();
}
get uid() {
return (firebase.auth().currentUser || {}).uid;
}
}
export default new Fire();