-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.js
More file actions
46 lines (41 loc) · 1.43 KB
/
profile.js
File metadata and controls
46 lines (41 loc) · 1.43 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
import {
initializeApp
} from 'https://www.gstatic.com/firebasejs/10.0.0/firebase-app.js'
// If you enabled Analytics in your project, add the Firebase SDK for Google Analytics
import {
getAnalytics
} from 'https://www.gstatic.com/firebasejs/10.0.0/firebase-analytics.js'
// Add Firebase products that you want to use
import {
getAuth
} from 'https://www.gstatic.com/firebasejs/10.0.0/firebase-auth.js'
import {
getFirestore
} from 'https://www.gstatic.com/firebasejs/10.0.0/firebase-firestore.js'
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyA0eRK6pFyX5Sz8-ZF7FjpLdoEeaCU7ECs",
authDomain: "codeendeavor.firebaseapp.com",
projectId: "codeendeavor",
storageBucket: "codeendeavor.appspot.com",
messagingSenderId: "502133308074",
appId: "1:502133308074:web:582ea78c320c2070e46ed3",
measurementId: "G-XX8MPR794Q"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
const auth = getAuth(app);
auth.onAuthStateChanged((user) => {
if (user) {
// User is signed in, see docs for a list of available properties
// https://firebase.google.com/docs/reference/js/v8/firebase.User
var uid = user.uid;
console.log(uid);
console.log(user.email);
// ...
} else {
window.open("home.html", "_self");
}
});