[Vuejs]-Fb.db.ref() is not a function – Firebase realtime with Vuejs

1👍

If you want to read data, then you need to use once():

  actions: {
    fetchUserProfile({ commit, state }) {
      fb.db.ref(`users/${state.currentUser.uid}`).once('value').then(res => { 
          commit('setUserProfile', res.val())
      }).catch(err => {
        console.log(err)
      })
    }
  },

check here for more info:

https://firebase.google.com/docs/database/web/read-and-write#read_data_once

Leave a comment