ts
38 lines
959 Bytes
| 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 | rootRef(): app.database.Reference { |
| 26 | return this.db.ref('setoelkahfi-web-id').child(this.language); |
| 27 | } |
| 28 | |
| 29 | whoAmIRef(): app.database.Reference { |
| 30 | return this.rootRef().child('i am'); |
| 31 | } |
| 32 | |
| 33 | aboutRef = () => this.rootRef().child('about'); |
| 34 | cvRef = () => this.rootRef().child('cv'); |
| 35 | contactRef = () => this.rootRef().child('contact'); |
| 36 | } |
| 37 | |
| 38 | export default Firebase; |