-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfirebase.js
More file actions
52 lines (43 loc) · 1.58 KB
/
firebase.js
File metadata and controls
52 lines (43 loc) · 1.58 KB
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
48
49
50
51
52
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import firebase from "firebase/app";
import {getFirestore} from "firebase/firestore";
import {getFunctions,connectFunctionsEmulator} from "firebase/functions";
import {getAuth,connectAuthEmulator,onAuthStateChanged} from "firebase/auth";
import Constants from "expo-constants";
import * as FirebaseCore from "expo-firebase-core";
console.ignoredYellowBox = [
"Setting a timer",
'AsyncStorage'
];
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyDc8GTACXcWMILMmLk9-pUaWowtGHvPdo4",
authDomain: "b5uberelectric-bacbb.firebaseapp.com",
projectId: "b5uberelectric-bacbb",
storageBucket: "b5uberelectric-bacbb.appspot.com",
messagingSenderId: "1053866920657",
appId: "1:1053866920657:web:1db10f617e6e7b639dd3f0"
};
// Initialize Firebase
const fireApp = initializeApp(firebaseConfig);
const fireAuth = getAuth(fireApp);
const fireDB = getFirestore(fireApp);
const fireFunc = getFunctions(fireApp);
if (__DEV__) {
console.log("Switching to local Firebase instance...");
const origin = "192.168.28.1";
//firebase.auth().useEmulator(`http://${origin}:9099/`);
//firebase.firestore().useEmulator(origin, 8080);
connectFunctionsEmulator(fireFunc,origin,5000);
}
fireFunc.region = 'europe-west1';
onAuthStateChanged(fireAuth, user => {
if (user != null) {
console.log('We are authenticated now!');
}else{
console.log('We are not authenticated now!');
}
// Do other things
});
export { fireApp, fireAuth, fireDB, fireFunc };