RC-4: move authRoles to src/app/configs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import i18next from 'i18next';
|
||||
|
||||
import SignUpPage from './SignUpPage';
|
||||
import authRoles from '../../../auth/authRoles';
|
||||
import authRoles from '../../../configs/authRoles';
|
||||
import en from './i18n/en';
|
||||
|
||||
i18next.addResourceBundle('en', 'signUpPage', en);
|
||||
|
||||
@@ -11,6 +11,7 @@ import Typography from '@mui/material/Typography';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { authService } from 'src/app/services';
|
||||
import * as yup from 'yup';
|
||||
import LeftSideCanvas from '../shared-components/LeftSideCanvas';
|
||||
|
||||
@@ -31,7 +32,7 @@ function SignUpPage({ t }) {
|
||||
acceptTermsConditions: yup.boolean().oneOf([true], t('accept_terms_error')),
|
||||
});
|
||||
|
||||
const { control, formState, handleSubmit, reset } = useForm({
|
||||
const { control, formState, handleSubmit, setError } = useForm({
|
||||
mode: 'onChange',
|
||||
defaultValues,
|
||||
resolver: yupResolver(schema),
|
||||
@@ -39,8 +40,19 @@ function SignUpPage({ t }) {
|
||||
|
||||
const { isValid, dirtyFields, errors } = formState;
|
||||
|
||||
function onSubmit() {
|
||||
reset(defaultValues);
|
||||
function onSubmit({ name, password, email }) {
|
||||
authService
|
||||
.createUser({
|
||||
displayName: name,
|
||||
password,
|
||||
email,
|
||||
})
|
||||
.catch((error) => {
|
||||
setError('root', {
|
||||
type: 'manual',
|
||||
message: error.message,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user