-1
I need to fire the DB check for an input. Can anyone help me? I saw some similar doubts here but could not resolve.
var firebaseConfig = {
apiKey: "AIzaSyBd-oV4iz3VnEL41DnNQrXcaQAKT4hPRU0",
authDomain: "suvs-e02e4.firebaseapp.com",
databaseURL: "https://suvs-e02e4.firebaseio.com",
projectId: "suvs-e02e4",
storageBucket: "suvs-e02e4.appspot.com",
messagingSenderId: "156256669497",
appId: "1:156256669497:web:a618f3f479291792e1a2e8"
};
document.getElementById('disp').onclick = () => {
firebase.initializeApp(firebaseConfig);
let SSO = document.getElementById('inputSso').value
let db = firebase.firestore();
let docRef = db.collection("SSOs").doc("NvZDEAmhG2Usyu2UW4Om")
docRef.get().then((doc) => {
let SSOs = doc.data().Ssos;
let Arsso = SSOs;
Arsso.includes(SSO) ? alert ("TEM") : alert("não tem")
})
}
<div class="form-group mx-sm-3 mb-2">
<label for="inputPassword2" class="sr-only"></label>
<input type="text" class="form-control" id="inputSso" placeholder="SSO">
</div>
<button type="submit" class="btn btn-primary mb-2" id="disp">Checar</button>
Thank you very much! That’s exactly it, thanks also for the edition!
– Caio Carvalho