From 5029c99ce94f46dfe00a68a0f848af3e1e081244 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 19 Feb 2025 22:06:39 -0800 Subject: [PATCH] fix: redirect to /w after google/github signin --- app/(auth)/login/page.tsx | 10 +++------- app/(auth)/verify/page.tsx | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index 4d11d62ad5..85560a2105 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -33,13 +33,11 @@ export default function LoginPage() { const password = formData.get('password') as string try { - const result = await client.signIn.email({ email, password }) + const result = await client.signIn.email({ email, password, callbackURL: '/w' }) if (!result || result.error) { throw new Error(result?.error?.message || 'Authentication failed') } - - router.push('/w/1') } catch (err: any) { let errorMessage = 'Invalid email or password' @@ -70,8 +68,7 @@ export default function LoginPage() { async function signInWithGithub() { try { - await client.signIn.social({ provider: 'github' }) - router.push('/w/1') + await client.signIn.social({ provider: 'github', callbackURL: '/w' }) } catch (err: any) { let errorMessage = 'Failed to sign in with GitHub' @@ -90,8 +87,7 @@ export default function LoginPage() { async function signInWithGoogle() { try { - await client.signIn.social({ provider: 'google' }) - router.push('/w/1') + await client.signIn.social({ provider: 'google', callbackURL: '/w' }) } catch (err: any) { let errorMessage = 'Failed to sign in with Google' diff --git a/app/(auth)/verify/page.tsx b/app/(auth)/verify/page.tsx index 7e32b7bb6a..911b0d8c49 100644 --- a/app/(auth)/verify/page.tsx +++ b/app/(auth)/verify/page.tsx @@ -22,8 +22,8 @@ function VerifyContent() { .verifyEmail({ query: { token } }) .then(() => { setStatus('success') - // Redirect to dashboard after a short delay - setTimeout(() => router.push('/w/1'), 2000) + // Redirect to workflow page after a short delay + setTimeout(() => router.push('/w'), 2000) }) .catch(() => setStatus('error')) }, [searchParams, router])