forked from CKStudios2018/OpenSource-uTube
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.js
More file actions
33 lines (29 loc) · 1.45 KB
/
auth.js
File metadata and controls
33 lines (29 loc) · 1.45 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
function loginFunction() {
const loginD = document.getElementById('login');
const user = firebase.auth().currentUser;
const yeid = sessionStorage.getItem('uid');
if(user){
store.collection('c').doc(user.uid).get().then(doc => {
const html =
`
<button onclick="location.href='https://common-codes.github.io/uTube/c/@me'" style="background-color: black; position: absolute; top: -21px; right: 36px; border: none;" aria-label="Account profile photo">
<img href="https://common-codes.github.io/uTube/login.html" title="Channel Image" alt="Avatar Image" src="${doc.data().img}" style="cursor: pointer; width: 32px; height: 32px; border-radius: 50%;">
</button>
`;
loginD.innerHTML = html;
})
} else if(yeid != null){
console.log('backup')
store.collection('c').doc(yeid).get().then(doc => {
const html =
`
<button onclick="location.href='https://common-codes.github.io/uTube/c/@me'" style="background-color: black; position: absolute; top: -21px; right: 36px; border: none;" aria-label="Account profile photo">
<img href="/login.html" title="Channel Avatar" alt="Avatar image" src="${doc.data().img}" style="cursor: pointer; width: 32px; height: 32px; border-radius: 50%;">
</button>
`;
loginD.innerHTML = html;
})
}else{
console.log("no auth")
}
}