[Vuejs]-Firestore vuejs chained calls stop

0👍

Tylerhan has answered the question on github. Here is the solution:

async signup () {
  this.performingRequest = true
  await fb.auth.createUserWithEmailAndPassword(this.signupForm.email, this.signupForm.password).then(user => {
    this.$store.commit('setCurrentUser', user.user)
  })
  const user = this.$store.getters.getCurrentUser
  const userProfile = {
    name: this.signupForm.name,
    title: this.signupForm.title
  }
  fb.usersCollection.doc(user.uid).set(userProfile).then(() => {
    this.$store.dispatch('fetchUserProfile')
    this.performingRequest = false
    this.$router.push('/dashboard')
  }).catch(err => {
    this.performingRequest = false
    console.log(err)
    this.errorMsg = err.message
  })
}

Leave a comment