-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirestore.js
47 lines (36 loc) · 1.14 KB
/
firestore.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
38
39
40
41
42
43
44
45
46
47
import firebase from 'firebase/compat/app';
import 'firebase/compat/firestore';
import 'firebase/compat/auth';
import 'firebase/compat/storage';
const config = {
apiKey: 'AIzaSyDe8mlwCePLeJ5yAwDRe7iWMb15y1M-o_o',
authDomain: 'vasagatantracker-spektrumrf.firebaseapp.com',
databaseURL: 'https://vasagatantracker-spektrumrf.firebaseio.com',
projectId: 'vasagatantracker-spektrumrf',
storageBucket: 'vasagatantracker-spektrumrf.appspot.com',
messagingSenderId: '118507293956'
};
firebase.initializeApp(config);
let db;
const setAppYear = (year) => {
db = firebase.firestore().collection('years').doc(year.toString());
};
const getAuth = () => {
return firebase.auth();
};
const getStorage = () => {
return firebase.storage();
};
const getDatabase = () => {
return db;
};
const getCollection = (name) => {
return db.collection(name);
};
const getProperties = () => {
return firebase.firestore().collection('properties');
};
const getYears = () => {
return firebase.firestore().collection('years');
};
export default { getDatabase, getCollection, setAppYear, getAuth, getProperties, getYears, getStorage };