Reputation: 1314
I submit the form in login.vue
which will call submit()
. Then I'm getting below error in the web console.
Uncaught TypeError: Cannot read property 'auth' of undefined
main.js
import Vue from 'vue'
import App from './App'
import router from './router'
import * as firebase from 'firebase/app'
import { firebaseConfig } from '@/firebaseConfig';
Vue.prototype.$firebase = firebase.initializeApp(firebaseConfig)
Vue.config.productionTip = false
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
login.vue
const authService = {
methods: {
submit () {
this.$firebase.auth().signInWithEmailAndPassword(this.login.email, this.login.pass).then(
(user) =>{
this.$router.replace('bm')
}
)
}
}
}
Upvotes: 1
Views: 395
Reputation: 317467
You also have to:
import 'firebase/auth'
after the firebase/app
import in order to get the Firebase Auth product functionality.
Upvotes: 1