Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const EditForm = ({
submission, onSubmit, onClose, onDelete,
}) => {
const {
register, errors, handleSubmit, formState,
} = useForm({
resolver: yupResolver(schema),
defaultValues: {
repo_url: submission.repo_url,
live_preview_url: submission.live_preview_url,
is_public: submission.is_public,
},
});
const handleDelete = () => {
onDelete(submission.id);
onClose();
};
if (formState.isSubmitSuccessful) {
return (
<div>
<h1>Thanks for Updating Your Solution!</h1></div>
const CreateForm = ({ onClose, onSubmit, userId }) => {
const { lesson } = useContext(ProjectSubmissionContext);
const {
register, handleSubmit, formState, errors,
} = useForm({
resolver: yupResolver(schema),
defaultValues: {
is_public: true,
},
});
if (userId === null) {
return (
<div>
<h1>Please Sign in</h1>
<p data-test-id="sign-in-instructions">
Please
{' '}
<a href="/login">sign in</a>
{' '}
to add a project submission.
</p></div>