Hola necesito ayuda con esto dice que
No detectado (en promesa) TypeError: Object(...)(...).once no es una función en eval (store.js?07a4:42:1) en eval (index-6de4cbb9.js?4d2d:2453: 1)
Aquí está mi código:
import { firebaseAuth, firebaseDb } from 'boot/firebase' import { createUserWithEmailAndPassword, signInWithEmailAndPassword,onAuthStateChanged } from "firebase/auth"; import { ref, set } from "firebase/database"; const state = { } const mutations = { } const actions = { registerUser({}, payload) { createUserWithEmailAndPassword(firebaseAuth, payload.email, payload.password) .then(response => { console.log(response) const userId = firebaseAuth.currentUser.uid set(ref(firebaseDb, 'users/' + userId), { name: payload.name, email: payload.email, online: true }) }).catch(error => { console.log(error.message) }) }, loginUser({}, payload) { signInWithEmailAndPassword(firebaseAuth, payload.email, payload.password) .then(response => { console.log(response) }).catch(error => { console.log(error.message) }) },
Aquí está la parte que es error:
handleAuthStateChanged() { onAuthStateChanged(firebaseAuth, user => { if (user) { // User is signed in, see docs for a list of available properties // https://firebase.google.com/docs/reference/js/firebase.User const userId = firebaseAuth.currentUser.uid ref(firebaseDb, 'users/' + userId).once('value', snapshot => { console.log('snapshot: ', snapshot) }) // ... } else {
El usuario ha cerrado la sesión
// ... } }) } } const getters = { } export default { namespaced: true, state, mutations, actions, getters }
no lo entiendo todavía recibí este tipo de error
<script> import { mapActions } from "vuex" export default { methods: { ...mapActions('store', ['handleAuthStateChanged']) }, mounted(){ this.handleAuthStateChanged() } } </script>
este es mi script App.vue