import React, { useState } from 'react'; import { Formik, Form, Field } from 'formik'; import { del } from 'lib/web'; import Button from 'components/interface/Button'; import FormLayout, { FormButtons, FormError, FormMessage, FormRow, } from 'components/layout/FormLayout'; const validate = ({ confirmation }) => { const errors = {}; if (confirmation !== 'DELETE') { errors.confirmation = !confirmation ? 'Required' : 'Invalid'; } return errors; }; export default function WebsiteDeleteForm({ initialValues, onSave, onClose }) { const [message, setMessage] = useState(); const handleSubmit = async ({ website_id }) => { const response = await del(`/api/website/${website_id}`); if (response) { onSave(); } else { setMessage('Something went wrong.'); } }; return ( {() => (
Are your sure you want to delete {initialValues.name}?
All associated data will be deleted as well.

Type DELETE in the box below to confirm.

{message}
)}
); }