Currently encountering an issue while working on VueJs where I am struggling to log data from Firebase. Despite making code adjustments based on the console's recommendations, nothing seems to be working as expected. My setup involves using Vue Cli 3 and Firebase version 5.5.9.
<script>
import db from './firebaseInit'
export default {
name: 'dashboard',
data(){
return{
employees: []
}
},
created(){
db.collection('employees').get().then
(querySnapshot => {
querySnapshot.forEach(doc => {
console.log(doc.data())
const data = {
}
})
})
}
}
</script>
The provided firebaseInit.js snippet:
import firebase from 'firebase'
import 'firebase/firestore'
import firebaseConfig from './firebaseConfig'
const firebaseApp = firebase.initializeApp(firebaseConfig)
// const firestore = firebase.firestore();
// const settings = {timestampsInSnapshots: true};
// firestore.settings(settings);
export default firebaseApp.firestore()