-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ab10c4
commit 6ac63c9
Showing
10 changed files
with
245 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,27 @@ | ||
import { createUserWithEmailAndPassword } from "firebase/auth"; | ||
import { auth, firestore } from "../../config/firebase"; | ||
import { collection } from "@firebase/firestore" | ||
import { addDoc } from "@firebase/firestore" | ||
import { collection } from "@firebase/firestore"; | ||
import { addDoc } from "@firebase/firestore"; | ||
|
||
export function createUser(data) { | ||
// Create the user with email and password | ||
createUserWithEmailAndPassword(auth, data.email, data.password) | ||
.then((userCredential) => { | ||
// User created successfully | ||
const user = userCredential.user; | ||
|
||
const userData = { | ||
name: data.name, | ||
role: data.role, | ||
email: user.email, | ||
uid: user.uid, | ||
}; | ||
|
||
|
||
export function createUser(email, password) { | ||
// Create the user with email and password | ||
createUserWithEmailAndPassword(auth, email, password) | ||
.then((userCredential) => { | ||
// User created successfully | ||
const user = userCredential.user; | ||
|
||
const userData = { | ||
nome: user.displayName, | ||
email: user.email, | ||
uid: user.uid, | ||
}; | ||
|
||
const ref = collection(firestore, "userData"); | ||
addDoc(ref, userData) | ||
|
||
}) | ||
.catch((error) => { | ||
// Handle errors | ||
console.error('Error creating user:', error.message); | ||
}); | ||
} | ||
const ref = collection(firestore, "userData"); | ||
addDoc(ref, userData); | ||
}) | ||
.catch((error) => { | ||
// Handle errors | ||
console.error("Error creating user:", error.message); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.