-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.js
35 lines (35 loc) · 1.26 KB
/
app.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
// Initialize Firebase
var config = {
apiKey: "AIzaSyDECYRkmOiwqIsmw3MJxf0XAxk0ljf4sGo",
authDomain: "resume-db-1403c.firebaseapp.com",
databaseURL: "https://resume-db-1403c.firebaseio.com",
projectId: "resume-db-1403c",
storageBucket: "resume-db-1403c.appspot.com",
messagingSenderId: "578628846812"
};
firebase.initializeApp(config);
var currentUser;
setTimeout(() => {
firebase.auth().onAuthStateChanged(function (user) {
// calling other window in here will run abruptly
if (user) {
//'printf(user);
//signed in
currentUser = user;
if (document.getElementById('user-photo')) { //to be sure we have such element on this page.
document.getElementById('user-photo').src = user.photoURL;
}
if (document.getElementById('user-name')) {
document.getElementById('user-name').innerHTML = user.displayName;
}
if (document.getElementById('user-id')) {
document.getElementById('user-id').innerHTML = user.email;
}
console.log("runs one time");
} else {
//not signed in
printf('not signed in');
currentUser = null;
}
});
}, 800);