From c2b1a40b48d585971ced443ad0e82a8c6e8aa5a3 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Wed, 29 Jan 2025 04:46:02 +0100 Subject: [PATCH 1/3] Add UserRegistration Jsdoc --- src/components/User/UserRegistration.component.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/User/UserRegistration.component.tsx b/src/components/User/UserRegistration.component.tsx index 45ecb7437..b39370357 100644 --- a/src/components/User/UserRegistration.component.tsx +++ b/src/components/User/UserRegistration.component.tsx @@ -14,6 +14,11 @@ interface IRegistrationData { lastName: string; } +/** + * User registration component that handles WooCommerce customer creation + * @function UserRegistration + * @returns {JSX.Element} - Rendered component with registration form + */ const UserRegistration = () => { const methods = useForm(); const [registerUser, { loading, error }] = useMutation(CREATE_USER); From ea91f65727a0bbfc01c21fa1ea93546e5d64d5b8 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Wed, 29 Jan 2025 04:48:03 +0100 Subject: [PATCH 2/3] Remove console log --- src/components/User/UserRegistration.component.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/User/UserRegistration.component.tsx b/src/components/User/UserRegistration.component.tsx index b39370357..7a766be98 100644 --- a/src/components/User/UserRegistration.component.tsx +++ b/src/components/User/UserRegistration.component.tsx @@ -32,14 +32,12 @@ const UserRegistration = () => { const customer = response.data?.registerCustomer?.customer; if (customer) { - console.log('Customer registration successful:', customer); setRegistrationCompleted(true); } else { throw new Error('Failed to register customer'); } } catch (err: unknown) { - const error = err as ApolloError; - console.error('Registration error:', error); + console.error('Registration error'); } }; From 59a3de9d7673cc960d313f89b06b490b2b3d10e5 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Wed, 29 Jan 2025 04:48:59 +0100 Subject: [PATCH 3/3] Cleanup --- src/components/User/UserRegistration.component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/User/UserRegistration.component.tsx b/src/components/User/UserRegistration.component.tsx index 7a766be98..9f0aeed44 100644 --- a/src/components/User/UserRegistration.component.tsx +++ b/src/components/User/UserRegistration.component.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { useMutation, ApolloError } from '@apollo/client'; +import { useMutation } from '@apollo/client'; import { useForm, FormProvider } from 'react-hook-form'; import { CREATE_USER } from '../../utils/gql/GQL_MUTATIONS'; import { InputField } from '../Input/InputField.component';