mirror of https://github.com/buster-so/buster.git
redirect for google
This commit is contained in:
parent
7ea7cae7bc
commit
6f1a60d4e5
|
@ -66,12 +66,14 @@ export const LoginForm: React.FC<{
|
|||
const result = await signInWithGoogle({ data: { redirectTo } });
|
||||
console.log('result', result);
|
||||
if (result && 'success' in result && !result.success) {
|
||||
setErrorMessages([result.error]);
|
||||
setErrorMessages([result.error || 'An error occurred during sign-in']);
|
||||
setLoading(null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!result?.error) {
|
||||
navigate({ to: redirectTo || '/' });
|
||||
if (result && 'success' in result && result.success && result.url) {
|
||||
// Redirect to OAuth provider's URL
|
||||
window.location.href = result.url;
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
console.error(error);
|
||||
|
|
|
@ -62,9 +62,9 @@ export const signInWithGoogle = createServerFn({ method: 'POST' })
|
|||
return { success: false, error: error.message };
|
||||
}
|
||||
|
||||
console.log('data', data);
|
||||
console.log('OAuth data:', data);
|
||||
|
||||
throw redirect({ href: data.url });
|
||||
return { success: true, url: data.url };
|
||||
});
|
||||
|
||||
export const signInWithAnonymousUser = createServerFn({ method: 'POST' }).handler(async () => {
|
||||
|
|
Loading…
Reference in New Issue