Skip to content
Snippets Groups Projects
Verified Commit a6bc547f authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Implement useIntl to try internalization

parent 75c7daa5
No related branches found
No related tags found
2 merge requests!17Axios,!13Basic form api and implement cookie entrypoint
Pipeline #11633 failed
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' })}
/>
)}
/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment