From 9e1548375241957dd295b0611f7d4c16c8d05819 Mon Sep 17 00:00:00 2001 From: isra el Date: Wed, 4 Jun 2025 22:32:31 +0300 Subject: [PATCH] fix(web): fix redirection issues after login --- web/app/(app)/(auth)/(components)/login-form.tsx | 5 ++--- web/app/(app)/(auth)/(components)/login-with-google.tsx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/web/app/(app)/(auth)/(components)/login-form.tsx b/web/app/(app)/(auth)/(components)/login-form.tsx index 141e10a..fa64110 100644 --- a/web/app/(app)/(auth)/(components)/login-form.tsx +++ b/web/app/(app)/(auth)/(components)/login-form.tsx @@ -39,7 +39,8 @@ export default function LoginForm() { const onSubmit = async (data: LoginFormValues) => { try { const result = await signIn('email-password-login', { - redirect: false, + redirect: true, + callbackUrl: Routes.dashboard, email: data.email, password: data.password, }) @@ -49,8 +50,6 @@ export default function LoginForm() { type: 'manual', message: 'Invalid email or password', }) - } else { - router.push(Routes.dashboard) } } catch (error) { console.error('login error:', error) diff --git a/web/app/(app)/(auth)/(components)/login-with-google.tsx b/web/app/(app)/(auth)/(components)/login-with-google.tsx index 9834705..41329d3 100644 --- a/web/app/(app)/(auth)/(components)/login-with-google.tsx +++ b/web/app/(app)/(auth)/(components)/login-with-google.tsx @@ -20,10 +20,10 @@ export default function LoginWithGoogle() { variant: 'default', }) await signIn('google-id-token-login', { - redirect: false, + redirect: true, + callbackUrl: redirect ? decodeURIComponent(redirect) : Routes.dashboard, idToken: credentialResponse.credential, }) - router.push(redirect ? decodeURIComponent(redirect) : Routes.dashboard) } const onGoogleLoginError = () => {