import { Service } from '@/types/service'; import React, { useState } from 'react'; import { useForm } from '@inertiajs/react'; import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog'; import { DropdownMenuItem } from '@/components/ui/dropdown-menu'; import { Button } from '@/components/ui/button'; import { LoaderCircleIcon } from 'lucide-react'; import FormSuccessful from '@/components/form-successful'; import InputError from '@/components/ui/input-error'; export function Action({ type, service }: { type: 'start' | 'stop' | 'restart' | 'enable' | 'disable'; service: Service }) { const [open, setOpen] = useState(false); const form = useForm(); const submit = () => { form.post(route(`services.${type}`, { server: service.server_id, service: service }), { onSuccess: () => { setOpen(false); }, }); }; return ( e.preventDefault()} className="capitalize"> {type} {type} service {type} service

Are you sure you want to {type} the service?

{Object.entries(form.errors).map(([key, value]) => ( ))}
); }