import { LoaderCircle } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { useForm } from '@inertiajs/react'; import { FormEventHandler, ReactNode, useState } from 'react'; import { Label } from '@/components/ui/label'; import InputError from '@/components/ui/input-error'; import { Form, FormField, FormFields } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; type SshKeyForm = { name: string; public_key: string; }; export default function AddSshKey({ children }: { children: ReactNode }) { const [open, setOpen] = useState(false); const form = useForm>({ name: '', public_key: '', }); const submit: FormEventHandler = (e) => { e.preventDefault(); form.post(route('ssh-keys.store'), { onSuccess: () => { setOpen(false); }, }); }; return ( {children} Add ssh key Add new ssh key
form.setData('name', e.target.value)} />