Browse Source

Merge pull request #88 from vernu/login-redirect-hotfix

fix(web): fix redirection issues after login
pull/90/head
Israel Abebe 9 months ago
committed by GitHub
parent
commit
59525cb126
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      web/app/(app)/(auth)/(components)/login-form.tsx
  2. 4
      web/app/(app)/(auth)/(components)/login-with-google.tsx

5
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)

4
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 = () => {

Loading…
Cancel
Save