I am trying to create a web application with ReactJs and firebase. I want to know how to create three users with different roles like doctor, patient, pharmacist.
My Signup.js file
if (pass.value != cpass.value) {
alert("Password dont match")
}
else {
try {
var e = email.value
const ref = db.collection("doctor")
setLoading(true)
await app
.auth()
.createUserWithEmailAndPassword(email.value, pass.value);
ref.doc(e).set({
"name": uname.value,
"dob": dob.value,
"email": email.value,
"phno": phno.value,
"regno": regno.value,
"regyear": regyear.value,
"gender": gender.value,
"addr": addr.value,
"pincode": pin.value,
"city": city.value,
"state": state.value,
"bloodtype": bloodtype.value,
"speciality": speciality.value,
}).then(() => {
console.log("Document successfully written!");
});
db.collection("users").doc(email.value).set({
"email":email.value,
"userType":"doctor"
})