[Vuejs]-Update Firestore document ID and auth email with same method

0👍

Look at this bit of code at the end of your function:

    var docRef = db.collection("users").doc(this.profile.id)

    return docRef.update({
      id: this.profile.id,
      fullname: this.profile.fullname
    })

    // update email address
    var user = firebase.auth().currentUser
      user.updateEmail(this.user.email).then(function() {
        console.log("success")
      }).catch(function(error) {
        // An error happened.
    })

You’re returning early from the function with the return keyword after you call the update() method, which means that any code after that in the function (the update of email address) won’t get run.

Leave a comment