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.") } }