-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirebase.js
More file actions
63 lines (50 loc) · 1.81 KB
/
Copy pathfirebase.js
File metadata and controls
63 lines (50 loc) · 1.81 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
// ---------------------------
// FIREBASE INITIALIZATION
// ---------------------------
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js";
import {
getAuth,
GoogleAuthProvider,
signInWithPopup,
signInWithEmailAndPassword,
createUserWithEmailAndPassword
} from "https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js";
import {
initializeFirestore,
persistentLocalCache,
persistentMultipleTabManager
} from "https://www.gstatic.com/firebasejs/10.7.1/firebase-firestore.js";
import { getStorage } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-storage.js";
const firebaseConfig = {
apiKey: "AIzaSyCfoaPyX6nxJm9I28oTWm4MxhNDHkZWmMo",
authDomain: "nuvvunenu-cf326.firebaseapp.com",
projectId: "nuvvunenu-cf326",
storageBucket: "nuvvunenu-cf326.firebasestorage.app",
messagingSenderId: "178972908907",
appId: "1:178972908907:web:475180e1fb38599cae802e",
measurementId: "G-FHQ8DL88M3"
};
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
// Enable offline persistence (caches data to IndexedDB to save reads!)
export const db = initializeFirestore(app, {
localCache: persistentLocalCache({tabManager: persistentMultipleTabManager()})
});
// Storage for voice notes / shared media
export const storage = getStorage(app);
// SINGLE clean provider
export const googleProvider = new GoogleAuthProvider();
// LOGIN FUNCTIONS
export function googleLogin() {
return signInWithPopup(auth, googleProvider);
}
export function loginEmail(email, pass) {
return signInWithEmailAndPassword(auth, email, pass);
}
export function signupEmail(email, pass) {
return createUserWithEmailAndPassword(auth, email, pass);
}
// MAKE ACCESSIBLE (optional)
window.googleLogin = googleLogin;
window.loginEmail = loginEmail;
window.signupEmail = signupEmail;