-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.js
35 lines (30 loc) · 1.13 KB
/
profile.js
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
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.22.2/firebase-app.js";
import { getAuth, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/9.22.2/firebase-auth.js";
// Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyAJVzWcSVu7nW-069bext5W6Nizx4sfxIA",
authDomain: "edu-hub-c81b5.firebaseapp.com",
projectId: "edu-hub-c81b5",
storageBucket: "edu-hub-c81b5.appspot.com",
messagingSenderId: "560742513136",
appId: "1:560742513136:web:102edd272982704fdb8535",
measurementId: "G-78TC8XTPF7"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
document.addEventListener('DOMContentLoaded', () => {
const signupSection = document.getElementById('signup-section');
onAuthStateChanged(auth, (user) => {
if (user) {
// Load user profile if user is signed in
loadUserProfile();
} else {
// Redirect to signup if user is not signed in
window.location.href = 'index.html';
}
});
function loadUserProfile() {
// Function to load user profile
}
});