import type { UrlMethodPair } from '@inertiajs/core'; import { router } from '@inertiajs/react'; import { usePasskeyVerify } from '@laravel/passkeys/react'; import { KeyRound } from 'lucide-react'; import { InputError } from '@/components/ui'; import { Button } from '@/components/ui/button'; import { Separator } from '@/components/ui/separator'; import { Spinner } from '@/components/ui/spinner'; type Props = { routes?: { options: UrlMethodPair; submit: UrlMethodPair; }; label?: string; loadingLabel?: string; separator?: string; }; export default function PasskeyVerify({ routes, label, loadingLabel, separator, }: Props = {}) { const { verify, isLoading, error, isSupported } = usePasskeyVerify({ ...(routes && { routes: { options: routes.options.url, submit: routes.submit.url, }, }), onSuccess: (response) => { router.visit(response.redirect ?? '/dashboard'); }, }); if (!isSupported) { return null; } return ( <>