( provider: AuthProvider, rememberMe: boolean, )
| 150 | } |
| 151 | |
| 152 | export async function signInWithPopup( |
| 153 | provider: AuthProvider, |
| 154 | rememberMe: boolean, |
| 155 | ): Promise<void> { |
| 156 | if (Auth === undefined) throw new Error("Authentication uninitialized"); |
| 157 | await setPersistence(rememberMe, true); |
| 158 | ignoreAuthCallback = true; |
| 159 | |
| 160 | const { data: signedInUser, error } = await tryCatch( |
| 161 | firebaseSignInWithPopup(Auth, provider), |
| 162 | ); |
| 163 | if (error !== null) { |
| 164 | ignoreAuthCallback = false; |
| 165 | console.log(error); |
| 166 | throw translateFirebaseError(error, "Failed to sign in with popup"); |
| 167 | } |
| 168 | const additionalUserInfo = getAdditionalUserInfo(signedInUser); |
| 169 | if (additionalUserInfo?.isNewUser) { |
| 170 | googleSignUpEvent.dispatch({ signedInUser, isNewUser: true }); |
| 171 | } else { |
| 172 | setUserState(signedInUser.user); |
| 173 | ignoreAuthCallback = false; |
| 174 | await readyCallback?.(true, signedInUser.user); |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | export async function createUserWithEmailAndPassword( |
| 179 | email: string, |
no test coverage detected