From bb50eabb35d5fab6b815ac194a6b776849d04965 Mon Sep 17 00:00:00 2001 From: yasaman Date: Tue, 13 Feb 2024 15:10:05 +0330 Subject: [PATCH] a bug fixed --- components/RequestStep2.tsx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/components/RequestStep2.tsx b/components/RequestStep2.tsx index 7118a90..88c3c92 100644 --- a/components/RequestStep2.tsx +++ b/components/RequestStep2.tsx @@ -65,6 +65,7 @@ interface Organization { export default function RequestStep2() { const router = useRouter(); const [file, setFile] = useState([]); + const [charCount, setCharCount] = useState(0); // Queries const { data: optionsData, isLoading: isLoadingData } = useQuery({ @@ -86,7 +87,7 @@ export default function RequestStep2() { .min(1, { message: "لطفا توضیحات خود را بنویسید.", }) - .max(300, { + .max(1024, { message: "تعداد کاراکترها بیشتر از حد مجاز میباشد.", }), uploadFile: z @@ -133,7 +134,7 @@ export default function RequestStep2() { mutationFn: postAuthorizedComplaintSubmit, onSuccess: (res) => { const currentDate = new Date(); - const formattedDate = currentDate.toISOString() + const formattedDate = currentDate.toISOString(); localStorage.setItem("trackingNumber", res.trackingNumber); localStorage.setItem("password", res.password); @@ -187,6 +188,11 @@ export default function RequestStep2() { }, }); + // Add the useEffect hook to monitor changes in the description field + useEffect(() => { + setCharCount(form.watch("description").length); + }, [form.watch("description")]); + function onSubmit(data: z.infer) { console.log(data); const formData = new FormData(); @@ -260,11 +266,11 @@ export default function RequestStep2() { render={({ field }) => ( - *موضوع شکایت + *موضوع گزارش @@ -279,7 +285,7 @@ export default function RequestStep2() { render={({ field }) => ( - *دستگاه مربوطه + *واحد مورد گزارش