Add redirectTo parameter to signInWithOAuth for staff login support

cgen-a5840c22e224448a971db83eb1de3b17
This commit is contained in:
Builder.io 2025-11-10 19:28:07 +00:00
parent c1e04dc893
commit 7d451e8bba

View file

@ -641,8 +641,16 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
}
};
const signInWithOAuth = async (provider: SupportedOAuthProvider) => {
const signInWithOAuth = async (
provider: SupportedOAuthProvider,
redirectTo?: string,
) => {
try {
// Store the intended redirect destination for after OAuth completes
if (redirectTo) {
sessionStorage.setItem("oauth_redirect_to", redirectTo);
}
const { data, error } = await supabase.auth.signInWithOAuth({
provider,
options: {