如何从数据库中读取电子邮件并登录并显示在控制台中?
function setupBase() {
var firebaseConfig = {
...
};
firebase.initializeApp(firebaseConfig);
var firestore = firebase.firestore();
const form = document.querySelector('form');
const db = firestore.collection('User');
form.addEventListener('submit', function (e) {
e.preventDefault();
let userEmail = document.querySelector('.input-email').value;
let userPassword = document.querySelector('.input-password').value;
db.doc().set({
email: userEmail,
password: userPassword
}).then(function () {
console.log('Data Saved')
document.querySelector('.input-email').value = ''
document.querySelector('.input-password').value = ''
document.querySelector('.icon-done>i').classList.toggle('active');
}).catch(function () {
console.log('Error')
})
})
}
export default setupBase;