Skip to content
Snippets Groups Projects

Axios

Merged Defendi Alberto requested to merge axios into dev
1 file
+ 8
3
Compare changes
  • Side-by-side
  • Inline
import React, { FC } from 'react';
import { useForm, Controller, appendErrors } from 'react-hook-form';
import { useIntl } from 'react-intl';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles';
import { TextField, Button } from '@material-ui/core';
import { DevTool } from '@hookform/devtools';
@@ -41,6 +42,7 @@ export const SignInForm: FC = () => {
const onSubmit: any = (values: FormData) => {
alert(JSON.stringify(values));
};
const intl = useIntl();
const classes = useStyles();
return (
<>
@@ -56,14 +58,17 @@ export const SignInForm: FC = () => {
rules={{
validate: (value) =>
/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(value),
required: { value: true, message: 'You must enter your email' },
required: {
value: true,
message: intl.formatMessage({ id: 'email' }),
},
}}
render={() => (
<InputField
id="email"
label="Email Address"
label={intl.formatMessage({ id: 'email' })}
error={Boolean(errors.email)}
errorMessage="Incorrect entry."
errorMessage={intl.formatMessage({ id: 'error' })}
/>
)}
/>
Loading