final page fix

This commit is contained in:
Jacob Levine 2019-03-07 20:18:54 -06:00
parent 12e39ecc84
commit ee4ee316dd

View File

@ -48,13 +48,13 @@ window.onload = function() {
window.location.replace('../'); window.location.replace('../');
} }
teamAssoc = firebase.firestore().collection('UserAssociations').doc(user.uid); teamAssoc = firebase.firestore().collection('UserAssociations').doc(user.uid);
teamAssoc.get().then(function(doc) { teamAssoc.get()..then(function(doc) {
if (doc.exists) { if (doc.exists) {
list = doc.data() list = doc.data()
teamNums = Object.keys(list) teamNums = Object.keys(list)
document.getElementById('teammem').innerHTML = "" document.getElementById('teammem').innerHTML = ""
for (var i = 0; i < teamNums.length; i++) { for (var i = 0; i < teamNums.length; i++) {
document.getElementById('teammem').innerHTML += "<tr><td>" + teamNums[i] + "</td><td>" + list[teamNums[i]] + "</td></tr>" document.getElementById('teammem').innerHTML += "<tr><td>" + teamNums[i] + "</td><td>" + list[teamNums[i]] + "</td>" + "<td><input type='button' class='btn' value='leave' onclick='leaveTeam(" + teamNums[i] + ")'></td></tr>"
} }
} else { } else {
document.getElementById('teammem').innerHTML = "<tr><td>You are not part of any teams</td></tr>" document.getElementById('teammem').innerHTML = "<tr><td>You are not part of any teams</td></tr>"
@ -162,20 +162,20 @@ function leaveTeam(tn) {
}) })
} }
function signout() { function signout() {
var user = firebase.auth().currentUser; var user = firebase.auth().currentUser;
firebase.auth().signOut().then( firebase.auth().signOut().then(
window.location.href = '../'); window.location.href = '../');
} }
function deleteAccount() { function deleteAccount() {
try { try {
firebase.auth().currentUser.delete().then( firebase.auth().currentUser.delete().then(
window.location.href = '../'); window.location.href = '../');
} catch (error) { } catch (error) {
if (error.code == 'auth/requires-recent-login') { if (error.code == 'auth/requires-recent-login') {
alert("Please sign in again to delete your account.") alert("Please sign in again to delete your account.")
window.location.href = '../'; window.location.href = '../';
}
} }
} }
}