From eb20ad907e71e77f27383a54f862c9c5f1614827 Mon Sep 17 00:00:00 2001 From: Jacob Levine Date: Thu, 7 Mar 2019 20:16:14 -0600 Subject: [PATCH] fix mistake --- website/public/team/scripts.js | 35 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/website/public/team/scripts.js b/website/public/team/scripts.js index 8f98c0cd..e2cb0b97 100644 --- a/website/public/team/scripts.js +++ b/website/public/team/scripts.js @@ -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 += "" + teamNums[i] + "" + list[teamNums[i]] + "" + "" - } - } else { - document.getElementById('teammem').innerHTML = "You are not part of any teams" + 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 += "" + teamNums[i] + "" + list[teamNums[i]] + "" + "" } - }) + } else { + document.getElementById('teammem').innerHTML = "You are not part of any teams" + } }) - ) + }) } - } + }) function signout() { var user = firebase.auth().currentUser;