MCPcopy Create free account
hub / github.com/WardAnalytics/WardGraph / signUpWithGoogle

Function signUpWithGoogle

src/services/auth/auth.services.ts:106–122  ·  view source on GitHub ↗
(
  onSuccess: (userID: string) => void,
  onError: (error: any) => void,
)

Source from the content-addressed store, hash-verified

104 * @param onError - callback function to be executed on signup error
105 */
106const 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

Callers

nothing calls this directly

Calls 1

createUserInDatabaseFunction · 0.90

Tested by

no test coverage detected