fix mistake

This commit is contained in:
Jacob Levine 2019-03-07 20:16:14 -06:00
parent 61b286c258
commit eb20ad907e

View File

@ -140,27 +140,26 @@ function reqjt(tn, tc) {
function leaveTeam(tn) {
teamAssoc = firebase.firestore().collection('UserAssociations').doc(user.uid)
teamAssoc.get().then(function(doc) {
if (doc.exists) {
list = doc.data()
delete list[tn]
firebase.firestore().collection("UserAssociations").doc(user.uid).set(list).then(function() {
teamAssoc = firebase.firestore().collection('UserAssociations').doc(user.uid)
teamAssoc.get().then(function(doc) {
if (doc.exists) {
list = doc.data()
teamNums = Object.keys(list)
document.getElementById('teammem').innerHTML = ""
for (var i = 0; i < teamNums.length; i++) {
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 {
document.getElementById('teammem').innerHTML = "<tr><td>You are not part of any teams</td></tr>"
if (doc.exists) {
list = doc.data()
delete list[tn]
firebase.firestore().collection("UserAssociations").doc(user.uid).set(list).then(function() {
teamAssoc = firebase.firestore().collection('UserAssociations').doc(user.uid)
teamAssoc.get().then(function(doc) {
if (doc.exists) {
list = doc.data()
teamNums = Object.keys(list)
document.getElementById('teammem').innerHTML = ""
for (var i = 0; i < teamNums.length; i++) {
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 {
document.getElementById('teammem').innerHTML = "<tr><td>You are not part of any teams</td></tr>"
}
})
)
})
}
}
})
function signout() {
var user = firebase.auth().currentUser;