-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Minor login improvements #322
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { useState } from 'react'; | ||
import { signIn } from 'next-auth/react'; | ||
import { useForm } from 'react-hook-form'; | ||
import NextLink from 'next/link'; | ||
import { useRouter } from 'next/router'; | ||
import Link from 'next/link'; | ||
|
||
|
@@ -91,11 +90,11 @@ export function LoginForm() { | |
</PasswordField> | ||
</div> | ||
<div className="flex justify-between"> | ||
<NextLink href="/reset-password"> | ||
<Button variant="link" size="sm"> | ||
<Link href="/reset-password"> | ||
<Button variant="link" size="sm" type="button"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the user hits enter on their keyboard, it redirected them to |
||
Forgot password? | ||
</Button> | ||
</NextLink> | ||
</Link> | ||
</div> | ||
<div className="flex gap-6 flex-col"> | ||
<Button variant="outline" type="submit" disabled={loading} data-testid="login-submit"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { ReactNode } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import { signOut } from 'next-auth/react'; | ||
|
||
import { Logo } from '@/components/Logo'; | ||
|
@@ -12,11 +11,8 @@ interface Props { | |
} | ||
|
||
export function LoggedInLayout({ children }: Props) { | ||
const router = useRouter(); | ||
|
||
async function handleLogout() { | ||
signOut(); | ||
await router.replace('/login'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This caused a flash to |
||
await signOut({ callbackUrl: '/login' }); | ||
} | ||
|
||
return ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think
NextLink
is necessary anymore. I'm also not seeing it in the "pages" docs