11import { useState } from 'react' ;
2- import { useMutation , ApolloError } from '@apollo/client' ;
2+ import { useMutation } from '@apollo/client' ;
33import { useForm , FormProvider } from 'react-hook-form' ;
44import { CREATE_USER } from '../../utils/gql/GQL_MUTATIONS' ;
55import { InputField } from '../Input/InputField.component' ;
@@ -14,6 +14,11 @@ interface IRegistrationData {
1414 lastName : string ;
1515}
1616
17+ /**
18+ * User registration component that handles WooCommerce customer creation
19+ * @function UserRegistration
20+ * @returns {JSX.Element } - Rendered component with registration form
21+ */
1722const UserRegistration = ( ) => {
1823 const methods = useForm < IRegistrationData > ( ) ;
1924 const [ registerUser , { loading, error } ] = useMutation ( CREATE_USER ) ;
@@ -27,14 +32,12 @@ const UserRegistration = () => {
2732
2833 const customer = response . data ?. registerCustomer ?. customer ;
2934 if ( customer ) {
30- console . log ( 'Customer registration successful:' , customer ) ;
3135 setRegistrationCompleted ( true ) ;
3236 } else {
3337 throw new Error ( 'Failed to register customer' ) ;
3438 }
3539 } catch ( err : unknown ) {
36- const error = err as ApolloError ;
37- console . error ( 'Registration error:' , error ) ;
40+ console . error ( 'Registration error' ) ;
3841 }
3942 } ;
4043
0 commit comments