-
Notifications
You must be signed in to change notification settings - Fork 4
/
about.js
40 lines (36 loc) · 1.15 KB
/
about.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
36
37
38
39
40
var firebaseConfig = {
apiKey: "AIzaSyBFkmspKoi-RDOMZfL-k9__70YIaS7vLn0",
authDomain: "notedemo-a1e15.firebaseapp.com",
projectId: "notedemo-a1e15",
storageBucket: "notedemo-a1e15.appspot.com",
messagingSenderId: "641128485554",
appId: "1:641128485554:web:db3794ada96d08b1ea2fab"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
const dbRef = firebase.database()
const auth = firebase.auth();
let fsignout=0;
//Authentication function to check if any user is logged in
firebase.auth().onAuthStateChanged(function(user) {
if(user){
//Logout Function
document.querySelector('#signout').addEventListener('click', function () {
auth.signOut()
.then(() => {
// Sign-out successful.
fsignout=1;
window.alert("You have Logged Out Succesfully.");
window.location = "index.html";
}).catch((error) => {
// An error happened.
alert(error.message);
});
});
}
else if(fsignout==0) {
window.alert("You need to LogIn First.Redirecting to Home Page.");
window.location="index.html";
}
});