import { useMutation } from '@tanstack/react-query'; import useApi from 'hooks/useApi'; import { Button, Form, FormButtons, FormInput, SubmitButton, TextField } from 'react-basics'; import styles from './Form.module.css'; const CONFIRM_VALUE = 'DELETE'; export default function WebsiteDeleteForm({ websiteId, onSave, onClose }) { const { del } = useApi(); const { mutate, error, isLoading } = useMutation(data => del(`/websites/${websiteId}`, data)); const handleSubmit = async data => { mutate(data, { onSuccess: async () => { onSave(); }, }); }; return (
To delete this website, type {CONFIRM_VALUE} in the box below to confirm.
value === CONFIRM_VALUE }} > Save
); }