MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / signInWithPopup

Function signInWithPopup

frontend/src/ts/firebase.ts:152–176  ·  view source on GitHub ↗
(
  provider: AuthProvider,
  rememberMe: boolean,
)

Source from the content-addressed store, hash-verified

150}
151
152export 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
178export async function createUserWithEmailAndPassword(
179 email: string,

Callers 1

signInWithProviderFunction · 0.90

Calls 5

tryCatchFunction · 0.90
setPersistenceFunction · 0.85
translateFirebaseErrorFunction · 0.85
setUserStateFunction · 0.85
dispatchMethod · 0.80

Tested by

no test coverage detected