Add redirectTo parameter to signInWithOAuth for staff login support
cgen-a5840c22e224448a971db83eb1de3b17
This commit is contained in:
parent
c1e04dc893
commit
7d451e8bba
1 changed files with 9 additions and 1 deletions
|
|
@ -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 {
|
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({
|
const { data, error } = await supabase.auth.signInWithOAuth({
|
||||||
provider,
|
provider,
|
||||||
options: {
|
options: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue