Repository navigation
Expand file tree
/
Copy pathfirebase.js
More file actions
65 lines (62 loc) · 2.17 KB
/
Copy pathfirebase.js
File metadata and controls
65 lines (62 loc) · 2.17 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
53
54
55
56
57
58
59
60
61
62
63
64
65
import {initializeApp, getApps, getApp} from "firebase/app";
import {getFirestore, query, where, doc, updateDoc} from "firebase/firestore";
import {
getAuth,
RecaptchaVerifier,
signInWithPhoneNumber,
PhoneAuthProvider,
signInWithCredential,
createUserWithEmailAndPassword,
signInWithEmailAndPassword,
browserLocalPersistence,
onAuthStateChanged,
signInAnonymously,
getReactNativePersistence
} from "firebase/auth";
import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage';
import {getStorage, ref, uploadBytes, uploadString, uploadBytesResumable, getDownloadURL} from "firebase/storage";
import {
setPersistence,
browserSessionPersistence,
inMemoryPersistence,
initializeAuth,
} from "firebase/auth";
import 'firebase/compat/auth';
import {collection, addDoc, getDocs} from "firebase/firestore";
const firebaseConfig = {
apiKey: "AIzaSyA7YPjH4TANOrbcVMhUhLserhRhAUfra_8",
authDomain: "offline-shop-rn.firebaseapp.com",
projectId: "offline-shop-rn",
storageBucket: "offline-shop-rn.appspot.com",
messagingSenderId: "976666911386",
appId: "1:976666911386:web:10029e33bb53004fae3523",
measurementId: "G-K70Y6EQG6G"
};
const app = initializeApp(firebaseConfig);
const auth = initializeAuth(app, {
persistence: getReactNativePersistence(ReactNativeAsyncStorage)
});
auth.onAuthStateChanged((user) => {
// console.log("firebase user",user)
})
onAuthStateChanged(auth, (user) => {
if (user) {
} else {
}
})
auth.onAuthStateChanged((user) => {
if (user) {
// console.log("firebase user", user)
} else {
// console.log("firebase user", user)
}
})
const firestore = getFirestore(app);
const storage = getStorage(app);
export {
auth, firestore, RecaptchaVerifier, signInWithPhoneNumber,
PhoneAuthProvider, signInWithCredential, app, createUserWithEmailAndPassword
, collection, addDoc, getDocs, storage, ref, uploadBytes, uploadString, uploadBytesResumable
, getDownloadURL, signInWithEmailAndPassword, query, where, doc, updateDoc, getAuth,
setPersistence, browserSessionPersistence, inMemoryPersistence, browserLocalPersistence, signInAnonymously
};