import { useForm, usePage } from '@inertiajs/react'; import type { SharedData } from '@/types'; import { FormEventHandler, ReactNode, useState } from 'react'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { CheckCircle2Icon, LoaderCircleIcon, XCircleIcon } from 'lucide-react'; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import { FormField, FormFields } from '@/components/ui/form'; import { Label } from '@/components/ui/label'; import { Textarea } from '@/components/ui/textarea'; import { Alert, AlertDescription } from '@/components/ui/alert'; function Disable(): ReactNode { const [open, setOpen] = useState(false); const form = useForm(); const submit = () => { form.post(route('profile.disable-two-factor'), { preserveScroll: true, onSuccess: () => setOpen(false), }); }; return ( Disable two factor Disable two factor

Are you sure you want to enable two factor authentication?

); } function Enable() { const form = useForm(); const submit: FormEventHandler = (e) => { e.preventDefault(); form.post(route('profile.enable-two-factor')); }; return ( ); } export default function TwoFactor() { const page = usePage< SharedData & { flash: { data?: { qr_code?: string; qr_code_url?: string; recovery_codes?: string[]; }; }; } >(); return ( Two factor authentication Enable or Disable two factor authentication {page.props.flash.data?.qr_code && (