I use firebase to store my users and their personal data.
I think there is no link between the information of the users and the authentication of my users. After registration the user profile displays all the information. But when I connect, I can only display the authentication information
How can I associate the two ?
register.vue :
register (){
   if (this.isFormValid()){
      firebase.auth().createUserWithEmailAndPassword(this.email, this.password).then( user => {
         user.updateProfile({
            displayName: this.firstname,
            }).then( ()=>{
               this.saveUserToUsersRef(user).then( ()=>{
                  const user = {
                    email: this.email,
                    firstname: this.firstname,
                    lastname: this.lastname,
                    manager: this.manager,
                    entreprise: this.entreprise,
                  }
          // this.writeUserData(firebase.uid, firebase.email)
            //execute la fonction setUser dans le fichier store (Vuex)
            this.$store.dispatch("setUser", user)
            //change de page
            this.$router.push('./profile')
          })
        }, error => {
          this.errors.push(error.message)
        })
      }).catch( error => {
        this.errors.push(error.message)
      })
    }
  },
  saveUserToUsersRef(user){
    return this.usersRef.child(user.uid).set({
      email: user.email,
      firstname: user.displayName,
      lastname: this.lastname,
      manager: this.manager,
      entreprise: this.entreprise,
    })
  },
store.js :
const mutations = {
  SET_USER(state, user){
    state.currentUser = user
  }
}
const actions = {
  setUser({commit},user){
    commit("SET_USER",user)
  },
  createUser({commit},user){
    firebase.database().ref('users').push(user)
      .then((user) => {
        commit('createUser', user)
      }).catch( (error) => {
        console.log(error)
    })
  }
}
const getters = {
  currentUser: state => state.currentUser
}
login.vue :
export default {
    name: 'Profile',
    computed: {
      ...mapGetters(['currentUser'])
    }
  }
 
    