import { SubmitButton, Form, FormInput, FormRow, FormButtons, TextField } from 'react-basics'; import { useMutation } from '@tanstack/react-query'; import { useRef } from 'react'; import useApi from 'hooks/useApi'; import { getClientAuthToken } from 'lib/client'; import { DOMAIN_REGEX } from 'lib/constants'; export default function WebsiteEditForm({ websiteId, data, onSave }) { const { post } = useApi(getClientAuthToken()); 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 (
Save
); }