From 834068244e9160e775c661bf6f7fd82a34e2bc30 Mon Sep 17 00:00:00 2001 From: Jacob Levine Date: Thu, 7 Mar 2019 19:43:50 -0600 Subject: [PATCH] test bugfix --- website/public/team/scripts.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/website/public/team/scripts.js b/website/public/team/scripts.js index b27696dc..138ca64d 100644 --- a/website/public/team/scripts.js +++ b/website/public/team/scripts.js @@ -98,7 +98,15 @@ function checkKeyMatch(dt,tn,key){ } function reqjt(tn,tc){ user=firebase.auth().currentUser; - dict=firebase.firestore().collection('teamData').doc('joinCodes').data(); + dict={} + firebase.firestore().collection('teamData').doc('joinCodes').get().then(function(doc){ + if (doc.exists) { + dict=doc.data(); + } else { + // doc.data() will be undefined in this case + console.log("No such document!"); + } + }); if (checkKeyMatch(dict,tn,tc)){ push={}; push[tn]='scout'; @@ -116,6 +124,8 @@ function reqjt(tn,tc){ document.getElementById('teammem').innerHTML = "You are not part of any teams" } }) + }else{ + alert("You don't have a correct join key. Please check it and try again.") } }