diff --git a/src/app/register/page.tsx b/src/app/register/page.tsx index 34dbea8..df56231 100644 --- a/src/app/register/page.tsx +++ b/src/app/register/page.tsx @@ -6,36 +6,27 @@ import { useForm, SubmitHandler } from 'react-hook-form' import { useState } from 'react' import { AiOutlineEye } from 'react-icons/ai' import { AiOutlineEyeInvisible } from 'react-icons/ai' - -interface signupInputs { - firstname: string - lastname: string - email: string - gender: string - birthday: any - country: string - city: string - password: string - confirmPassword: string - tnc: boolean | string -} +import { RegisterForm } from '@/models/auth' +import { useHandleRegister } from '@/services/auth' const SignUp = () => { const [showPassword, setShowPassword] = useState(false) const [showConfirmPassword, setShowConfirmPassword] = useState(false) + const { mutate: mutateRegister } = useHandleRegister() const { register: registerSignup, handleSubmit: handleSubmitSignup, formState: { errors: signupErrors }, watch, - } = useForm() + } = useForm() // Get the current values of password and confirmPassword const password = watch('password') - const onSignupSubmit: SubmitHandler = (data) => { + const onSignupSubmit: SubmitHandler = (data) => { console.log(data) console.log('signup errors', signupErrors) + mutateRegister(data) } return ( @@ -101,7 +92,7 @@ const SignUp = () => { {signupErrors.birthday && Please enter your birth date!} @@ -122,7 +113,7 @@ const SignUp = () => { placeholder="City" className=" border pl-3 py-2 text-md rounded-lg border-gray-light font-normal" /> - {signupErrors.firstname && Please enter your City!} + {signupErrors.city && Please enter your City!} @@ -218,7 +209,7 @@ const SignUp = () => { {/* checkbox for remember me */}
- +