refactor(validation): restucture api input and output validation
This commit is contained in:
parent
485a95f99a
commit
eef17c5360
34 changed files with 1891 additions and 1802 deletions
|
@ -6,7 +6,7 @@ import { useRouter } from 'next/navigation';
|
|||
import LabeledInput from '@/components/custom-ui/labeled-input';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import useZodForm from '@/lib/hooks/useZodForm';
|
||||
import { loginClientSchema, registerClientSchema } from '@/lib/validation/user';
|
||||
import { loginSchema, registerSchema } from '@/lib/auth/validation';
|
||||
import { loginAction } from '@/lib/auth/login';
|
||||
import { registerAction } from '@/lib/auth/register';
|
||||
|
||||
|
@ -18,7 +18,7 @@ function LoginFormElement({
|
|||
formRef?: React.RefObject<HTMLFormElement | null>;
|
||||
}) {
|
||||
const { handleSubmit, formState, register, setError } =
|
||||
useZodForm(loginClientSchema);
|
||||
useZodForm(loginSchema);
|
||||
const router = useRouter();
|
||||
|
||||
const onSubmit = handleSubmit(async (data) => {
|
||||
|
@ -95,7 +95,7 @@ function RegisterFormElement({
|
|||
formRef?: React.RefObject<HTMLFormElement | null>;
|
||||
}) {
|
||||
const { handleSubmit, formState, register, setError } =
|
||||
useZodForm(registerClientSchema);
|
||||
useZodForm(registerSchema);
|
||||
|
||||
const onSubmit = handleSubmit(async (data) => {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue