On `MailerSubscriber` also has this same pattern.
Why is that? What is the use in this context?
<Formik
initialValues={{
email: '',
submit: null
}}
validationSchema={Yup.object().shape({
email: Yup.string().email('Must be a valid email').max(255).required('Email is required')
})}
onSubmit={async (values, { setErrors, setStatus, setSubmitting }) => {
try {
const options = {
headers: {
'content-type': 'application/json'
}
};
await axios.post('https://yourapicall', { email: values.email }, options);
dispatch(
openSnackbar({
open: true,
message: 'Success! Please check inbox and confirm.',
variant: 'alert',
alert: {
color: 'success'
},
close: false
})
);
if (scriptedRef.current) {
setStatus({ success: true });
setSubmitting(false);
}
} catch (err: any) {
if (scriptedRef.current) {
setStatus({ success: false });
setErrors({ submit: err?.message });
setSubmitting(false);
}
}
}}
>
On `MailerSubscriber` also has this same pattern.
Why is that? What is the use in this context?