diff options
Diffstat (limited to 'src-migrate/modules/register/components/Form.tsx')
| -rw-r--r-- | src-migrate/modules/register/components/Form.tsx | 53 |
1 files changed, 32 insertions, 21 deletions
diff --git a/src-migrate/modules/register/components/Form.tsx b/src-migrate/modules/register/components/Form.tsx index ac194b46..fc1567ab 100644 --- a/src-migrate/modules/register/components/Form.tsx +++ b/src-migrate/modules/register/components/Form.tsx @@ -3,9 +3,17 @@ import { useMutation } from "react-query"; import { useRegisterStore } from "~/common/stores/useRegisterStore"; import { RegisterProps } from "~/common/types/auth"; import { registerUser } from "~/services/auth"; +import TermCondition from "./TermCondition"; +import FormCaptcha from "./FormCaptcha"; const Form = () => { - const { form, isValid, isCheckedTNC, updateForm, toggleCheckTNC, openTNC } = useRegisterStore() + const { + form, + isValid, + isCheckedTNC, + isValidCaptcha, + updateForm, + } = useRegisterStore() const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => { const { name, value } = event.target; @@ -20,8 +28,10 @@ const Form = () => { e.preventDefault() const response = await mutation.mutateAsync(form) - console.log(response); + if (response?.register === true) { + + } } return ( @@ -58,6 +68,20 @@ const Form = () => { </div> <div> + <label htmlFor='phone'>No Handphone</label> + + <input + type='tel' + id='phone' + name='phone' + className='form-input mt-3' + placeholder='08xxxxxxxx' + value={form.phone} + onChange={handleInputChange} + /> + </div> + + <div> <label htmlFor='email'>Alamat Email</label> <input @@ -68,6 +92,7 @@ const Form = () => { placeholder='Masukan alamat email anda' value={form.email} onChange={handleInputChange} + autoComplete="username" /> </div> @@ -81,32 +106,18 @@ const Form = () => { placeholder='••••••••••••' value={form.password} onChange={handleInputChange} + autoComplete="current-password" /> </div> - <div className="mt-4"> - <input - type="checkbox" - name="tnc" - id="tnc" - checked={isCheckedTNC} - onClick={toggleCheckTNC} - /> - <label htmlFor="tnc" className="ml-2 cursor-pointer">Dengan ini saya menyetujui</label> - {' '} - <span - className="font-medium text-danger-500 cursor-pointer" - onClick={openTNC} - > - syarat dan ketentuan - </span> - <label htmlFor="tnc" className="ml-2 cursor-pointer">yang berlaku</label> - </div> + <FormCaptcha /> + + <TermCondition /> <button type="submit" className="btn-yellow w-full mt-2" - disabled={!isValid || !isCheckedTNC || mutation.isLoading} + disabled={!isValid || !isCheckedTNC || mutation.isLoading || !isValidCaptcha} > {mutation.isLoading ? 'Loading...' : 'Daftar'} </button> |
