Skip to content

Commit b05bd77

Browse files
authored
Merge pull request #125 from dohomi/patch-1
Add option to hook "createUserWithEmailAndPassword" for enabling email verification sendout
2 parents e033e30 + 1ba24f4 commit b05bd77

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

auth/useCreateUserWithEmailAndPassword.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState, useMemo } from 'react';
22
import firebase from 'firebase/app';
33
import { EmailAndPasswordActionHook } from './types';
44

5-
export default (auth: firebase.auth.Auth): EmailAndPasswordActionHook => {
5+
export default (auth: firebase.auth.Auth, options?:{sendEmailVerification?: boolean}): EmailAndPasswordActionHook => {
66
const [error, setError] = useState<firebase.FirebaseError>();
77
const [
88
registeredUser,
@@ -17,6 +17,9 @@ export default (auth: firebase.auth.Auth): EmailAndPasswordActionHook => {
1717
setLoading(true);
1818
try {
1919
const user = await auth.createUserWithEmailAndPassword(email, password);
20+
if (options?.sendEmailVerification) {
21+
await user.user.sendEmailVerification()
22+
}
2023
setRegisteredUser(user);
2124
setLoading(false);
2225
} catch (error) {

0 commit comments

Comments
 (0)