()
| 31 | }; |
| 32 | |
| 33 | const registerHandler = async () => { |
| 34 | if (!name) { |
| 35 | return alert("Please enter a full name!"); |
| 36 | } |
| 37 | |
| 38 | try { |
| 39 | const userAuth = await auth.createUserWithEmailAndPassword( |
| 40 | email, |
| 41 | password |
| 42 | ); |
| 43 | |
| 44 | await userAuth.user.updateProfile({ |
| 45 | displayName: name, |
| 46 | photoUrl: profilePic, |
| 47 | }); |
| 48 | |
| 49 | dispatch( |
| 50 | login({ |
| 51 | email: userAuth.user.email, |
| 52 | uid: userAuth.user.uid, |
| 53 | displayName: name, |
| 54 | photoUrl: profilePic, |
| 55 | }) |
| 56 | ); |
| 57 | } catch (error) { |
| 58 | console.log(error); |
| 59 | alert(error); |
| 60 | } |
| 61 | }; |
| 62 | |
| 63 | return ( |
| 64 | <div className="login"> |