-
Notifications
You must be signed in to change notification settings - Fork 0
/
firebaseConf.ts
74 lines (58 loc) Β· 2.02 KB
/
firebaseConf.ts
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
66
67
68
69
70
71
72
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
// import { getAnalytics } from "firebase/analytics";
// import { getDatabase } from "firebase/database";
import { getFirestore } from "firebase/firestore";
import { getAuth } from "firebase/auth";
import { GoogleAuthProvider } from "firebase/auth";
import { signInWithPopup } from "firebase/auth";
import { signOut } from "firebase/auth";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
// conf
apiKey: "AIzaSyB_9eSB3MS2LAuPryezoR4V1VNiGxRglVQ",
authDomain: "wagering-game-app.firebaseapp.com",
projectId: "wagering-game-app",
storageBucket: "wagering-game-app.appspot.com",
messagingSenderId: "371448353837",
appId: "1:371448353837:web:01f97fb8b0455de83ed4a4",
measurementId: "G-9HTG04SV2R"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
// const analytics = getAnalytics(app);
// export const database = getDatabase(app);
export const auth = getAuth(app);
export const firestore = getFirestore(app);
const provider = new GoogleAuthProvider();
// whenever a user interacts with the provider, we force them to select an account
provider.setCustomParameters({
prompt: "select_account ",
});
export const signInWithGooglePopup = () => signInWithPopup(auth, provider);
export const signOutUser = () => {
signOut(auth)
.then(() => {
localStorage.clear();
// toast.success("Logged out successfully", { transition: Zoom });
console.log("Logged out successfully");
window.location.href = "#/";
window.location.reload();
})
.catch((error: any) => {
// An error happened.
console.error(error);
});
};
// export {
// auth,
// firestore,
// database,
// storage,
// signInWithGooglePopup,
// signOutUser,
// };
// dample game creatingb