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