Skip to content

Commit e1c0ab8

Browse files
committed
Update verify-email.tsx
1 parent ec73253 commit e1c0ab8

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed
Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
11
// Components
2-
import { Head, useForm } from '@inertiajs/react';
2+
import { Form, Head } from '@inertiajs/react';
33
import { LoaderCircle } from 'lucide-react';
4-
import { FormEventHandler } from 'react';
54

65
import TextLink from '@/components/text-link';
76
import { Button } from '@/components/ui/button';
87
import AuthLayout from '@/layouts/auth-layout';
98

109
export default function VerifyEmail({ status }: { status?: string }) {
11-
const { post, processing } = useForm({});
12-
13-
const submit: FormEventHandler = (e) => {
14-
e.preventDefault();
15-
16-
post(route('verification.send'));
17-
};
18-
1910
return (
2011
<AuthLayout title="Verify email" description="Please verify your email address by clicking on the link we just emailed to you.">
2112
<Head title="Email verification" />
@@ -26,16 +17,20 @@ export default function VerifyEmail({ status }: { status?: string }) {
2617
</div>
2718
)}
2819

29-
<form onSubmit={submit} className="space-y-6 text-center">
30-
<Button disabled={processing} variant="secondary">
31-
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
32-
Resend verification email
33-
</Button>
34-
35-
<TextLink href={route('logout')} method="post" className="mx-auto block text-sm">
36-
Log out
37-
</TextLink>
38-
</form>
20+
<Form method="post" action={route('verification.send')} className="space-y-6 text-center">
21+
{({ processing }) => (
22+
<>
23+
<Button disabled={processing} variant="secondary">
24+
{processing && <LoaderCircle className="h-4 w-4 animate-spin" />}
25+
Resend verification email
26+
</Button>
27+
28+
<TextLink href={route('logout')} method="post" className="mx-auto block text-sm">
29+
Log out
30+
</TextLink>
31+
</>
32+
)}
33+
</Form>
3934
</AuthLayout>
4035
);
4136
}

0 commit comments

Comments
 (0)