diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-11-10 14:49:32 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-11-10 14:49:32 +0700 |
| commit | feea1a2602e22659fe73cb55e31c3d01f57218a4 (patch) | |
| tree | cab8555a5ab1a464ce469eb49bc64e584e1759af /src-migrate/modules/register/components | |
| parent | 8c583093ea9d703d96b899db08edc6707b4dc258 (diff) | |
| parent | 4bed066c03dc55a8f811ff2e23e019d8adc64495 (diff) | |
Merge branch 'refactor/all' into development
# Conflicts:
# src-migrate/modules/register/components/Form.tsx
Diffstat (limited to 'src-migrate/modules/register/components')
| -rw-r--r-- | src-migrate/modules/register/components/Form.tsx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src-migrate/modules/register/components/Form.tsx b/src-migrate/modules/register/components/Form.tsx index 76466abc..63a84776 100644 --- a/src-migrate/modules/register/components/Form.tsx +++ b/src-migrate/modules/register/components/Form.tsx @@ -1,4 +1,4 @@ -import { ChangeEvent, useEffect } from "react"; +import { ChangeEvent, useMemo } from "react"; import { useMutation } from "react-query"; import { useRegisterStore } from "~/common/stores/useRegisterStore"; import { RegisterProps } from "~/common/types/auth"; @@ -8,18 +8,21 @@ import FormCaptcha from "./FormCaptcha"; import { useRouter } from "next/router"; import { UseToastOptions, useToast } from "@chakra-ui/react"; import Link from "next/link"; -import { registerSchema } from "~/common/validations/auth"; const Form = () => { const { form, - isValid, isCheckedTNC, isValidCaptcha, errors, updateForm, validate, } = useRegisterStore() + + const isFormValid = useMemo(() => { + return Object.keys(errors).length === 0 + }, [errors]) + const router = useRouter() const toast = useToast() @@ -167,7 +170,7 @@ const Form = () => { <button type="submit" className="btn-yellow w-full mt-2" - disabled={!isValid || !isCheckedTNC || mutation.isLoading} + disabled={!isFormValid || !isCheckedTNC || mutation.isLoading} > {mutation.isLoading ? 'Loading...' : 'Daftar'} </button> |
