|
1
|
import app from 'firebase/app'; |
|
2
|
import 'firebase/database'; |
|
3
|
|
|
4
|
// Initialize Firebase |
|
5
|
const config = { |
|
6
|
apiKey: "AIzaSyBDMgSgpCGpPQVs2ziPm5igl2nL8I6jdeQ", |
|
7
|
authDomain: "blazing-fire-5965.firebaseapp.com", |
|
8
|
databaseURL: "https://blazing-fire-5965.firebaseio.com", |
|
9
|
projectId: "blazing-fire-5965", |
|
10
|
storageBucket: "blazing-fire-5965.appspot.com", |
|
11
|
messagingSenderId: "1043865982157" |
|
12
|
}; |
|
13
|
|
|
14
|
class Firebase { |
|
15
|
|
|
16
|
db: app.database.Database; |
|
17
|
language: string; |
|
18
|
|
|
19
|
constructor(language: string) { |
|
20
|
app.initializeApp(config); |
|
21
|
this.db = app.database(); |
|
22
|
this.language = language; |
|
23
|
} |
|
24
|
|
|
25
|
setLanguage(language: string) { |
|
26
|
this.language = language |
|
27
|
} |
|
28
|
|
|
29
|
rootRef(): app.database.Reference { |
|
30
|
return this.db.ref('setoelkahfi-web-id').child(this.language); |
|
31
|
} |
|
32
|
|
|
33
|
whoAmIRef(): app.database.Reference { |
|
34
|
return this.rootRef().child('i am'); |
|
35
|
} |
|
36
|
|
|
37
|
aboutRef = () => this.rootRef().child('about'); |
|
38
|
cvRef = () => this.rootRef().child('cv'); |
|
39
|
contactRef = () => this.rootRef().child('contact'); |
|
40
|
} |
|
41
|
|
|
42
|
export default Firebase; |