( onSuccess: (userID: string) => void, onError: (error: any) => void, )
| 104 | * @param onError - callback function to be executed on signup error |
| 105 | */ |
| 106 | const signUpWithGoogle = async ( |
| 107 | onSuccess: (userID: string) => void, |
| 108 | onError: (error: any) => void, |
| 109 | ) => { |
| 110 | await signInWithPopup(auth, googleProvider) |
| 111 | .then((userCredential) => { |
| 112 | localStorage.setItem("user", JSON.stringify(userCredential.user)); |
| 113 | |
| 114 | // Saves user in the firestore database |
| 115 | createUserInDatabase(userCredential.user).then(() => { |
| 116 | onSuccess(userCredential.user.uid); |
| 117 | }); |
| 118 | }) |
| 119 | .catch((error) => { |
| 120 | onError(error); |
| 121 | }); |
| 122 | }; |
| 123 | |
| 124 | /** |
| 125 | * Get the current user |
nothing calls this directly
no test coverage detected