I want to get the user id on my newly created user so I could name my document to that uid, but it says null.
here's my code
addDriver(){
var $this = this
secondaryApp.auth().createUserWithEmailAndPassword($this.driver.email, $this.driver.password).then(function(user){
$this.$db.collection("driver").doc(user.uid)
.set({
fname: $this.driver.fname,
lname: $this.driver.lname,
contact_number: $this.driver.cnum,
license_number: $this.driver.license,
email: $this.driver.email,
password: $this.driver.password,
})
secondaryApp.auth().signOut();
$this.formHeaderStatus = $this.$db.auth().currentUser
})
},
Also, am I doing this right? coz I'm logged in as an admin? and I want to create a new user without logging myself out.