import { SubmitButton, Form, FormInput, FormRow, FormButtons, TextField } from 'react-basics'; import { useRef } from 'react'; import useApi from 'hooks/useApi'; import { DOMAIN_REGEX } from 'lib/constants'; import useMessages from 'hooks/useMessages'; export default function WebsiteEditForm({ websiteId, data, onSave }) { const { formatMessage, labels, messages } = useMessages(); const { post, useMutation } = useApi(); const { mutate, error } = useMutation(data => post(`/websites/${websiteId}`, data)); const ref = useRef(null); const handleSubmit = async data => { mutate(data, { onSuccess: async () => { ref.current.reset(data); onSave(data); }, }); }; return (
{formatMessage(labels.save)}
); }