feat: update migration logic and remove consolelog
This commit is contained in:
@@ -51,9 +51,8 @@ function renderFields(props: { loading: boolean }) {
|
|||||||
Login
|
Login
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
|
|
||||||
|
<Typography variant="body1" align="center" mt={3}>
|
||||||
<Typography variant="body1" align='center' mt={3}>
|
Don't have an Automatisch account yet?
|
||||||
Don't have an Automatisch account yet?
|
|
||||||
<Link to={URLS.SIGNUP}>Sign Up</Link>
|
<Link to={URLS.SIGNUP}>Sign Up</Link>
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
|
@@ -8,10 +8,11 @@ import * as yup from 'yup';
|
|||||||
|
|
||||||
import useAuthentication from 'hooks/useAuthentication';
|
import useAuthentication from 'hooks/useAuthentication';
|
||||||
import * as URLS from 'config/urls';
|
import * as URLS from 'config/urls';
|
||||||
import { LOGIN } from 'graphql/mutations/login';
|
import { CREATE_USER } from 'graphql/mutations/create-user.ee';
|
||||||
import Form from 'components/Form';
|
import Form from 'components/Form';
|
||||||
import TextField from 'components/TextField';
|
import TextField from 'components/TextField';
|
||||||
import { yupResolver } from '@hookform/resolvers/yup';
|
import { yupResolver } from '@hookform/resolvers/yup';
|
||||||
|
import { LOGIN } from 'graphql/mutations/login';
|
||||||
|
|
||||||
const validationSchema = yup.object().shape({
|
const validationSchema = yup.object().shape({
|
||||||
fullName: yup.string().required(),
|
fullName: yup.string().required(),
|
||||||
@@ -33,6 +34,7 @@ const initialValue = {
|
|||||||
function SignUpForm() {
|
function SignUpForm() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const authentication = useAuthentication();
|
const authentication = useAuthentication();
|
||||||
|
const [createUser] = useMutation(CREATE_USER);
|
||||||
const [login, { loading }] = useMutation(LOGIN);
|
const [login, { loading }] = useMutation(LOGIN);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@@ -42,9 +44,16 @@ function SignUpForm() {
|
|||||||
}, [authentication.isAuthenticated]);
|
}, [authentication.isAuthenticated]);
|
||||||
|
|
||||||
const handleSubmit = async (values: any) => {
|
const handleSubmit = async (values: any) => {
|
||||||
|
const { fullName, email, password } = values;
|
||||||
|
await createUser({
|
||||||
|
variables: {
|
||||||
|
input: { fullName, email, password },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const { data } = await login({
|
const { data } = await login({
|
||||||
variables: {
|
variables: {
|
||||||
input: values,
|
input: { email, password },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -53,8 +62,6 @@ function SignUpForm() {
|
|||||||
authentication.updateToken(token);
|
authentication.updateToken(token);
|
||||||
};
|
};
|
||||||
|
|
||||||
//const render = React.useMemo(() => renderFields({ loading }), [loading]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper sx={{ px: 2, py: 4 }}>
|
<Paper sx={{ px: 2, py: 4 }}>
|
||||||
<Typography
|
<Typography
|
||||||
|
10
packages/web/src/graphql/mutations/create-user.ee.ts
Normal file
10
packages/web/src/graphql/mutations/create-user.ee.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { gql } from '@apollo/client';
|
||||||
|
|
||||||
|
export const CREATE_USER = gql`
|
||||||
|
mutation CreateUser($input: CreateUserInput) {
|
||||||
|
createUser(input: $input) {
|
||||||
|
email
|
||||||
|
fullName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
Reference in New Issue
Block a user