Created
May 17, 2025 15:27
-
-
Save LucasMagnum/ca38729f31b28fb1777dad4be90c205d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const signInWithGoogle = async () => { | |
setLoading(true); | |
try { | |
await signInWithPopup(auth, googleProvider); | |
toast({ | |
title: "Signed In", | |
description: "Successfully signed in with Google.", | |
}); | |
} catch (error) { | |
console.error("Google Sign-In Error:", error); | |
toast({ | |
title: "Sign-In Error", | |
description: "Could not sign in with Google. Please try again.", | |
variant: "destructive", | |
}); | |
setUser(null); // Ensure user is null on error | |
} finally { | |
// onAuthStateChanged will set loading to false once user state is confirmed | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment