Refactor validation schema by renaming 'comments' to 'comment' in ConfirmReversalPopups and RejectReversalPopups components
This commit is contained in:
@@ -25,7 +25,7 @@ import { useForm } from "react-hook-form";
|
||||
import ReactQuill from "react-quill";
|
||||
|
||||
export const conformModalSchema = yup.object().shape({
|
||||
comments: yup
|
||||
comment: yup
|
||||
.string()
|
||||
.min(2, "Minimum length should be 150 characters.")
|
||||
.max(150, "Maximum length should be 150 characters.")
|
||||
@@ -93,24 +93,24 @@ const ConfirmReversalPopups = ({
|
||||
<Textarea
|
||||
rows={6}
|
||||
focusBorderColor="green.400"
|
||||
name="comments"
|
||||
{...register("comments")}
|
||||
name="comment"
|
||||
{...register("comment")}
|
||||
fontSize="sm"
|
||||
type="textarea"
|
||||
size="md"
|
||||
placeholder={"Enter your comments...."}
|
||||
placeholder={"Enter your comment...."}
|
||||
rounded={"md"}
|
||||
resize={"none"}
|
||||
mb={2}
|
||||
/>
|
||||
{errors.comments ? (
|
||||
{errors.comment ? (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.comments.message}
|
||||
{errors.comment.message}
|
||||
</Text>
|
||||
) : (
|
||||
<Text fontSize="xs" color="gray.500">
|
||||
Maximum length should be 150 characters. You have entered{" "}
|
||||
{watch()?.comments?.length || 0} characters.
|
||||
{watch()?.comment?.length || 0} characters.
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
@@ -21,7 +21,7 @@ import { yupResolver } from "@hookform/resolvers/yup";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
export const conformModalSchema = yup.object().shape({
|
||||
comments: yup
|
||||
comment: yup
|
||||
.string()
|
||||
.min(2, "Minimum length should be 150 characters.")
|
||||
.max(150, "Maximum length should be 150 characters.")
|
||||
@@ -66,24 +66,24 @@ const RejectReversalPopups = ({
|
||||
<Textarea
|
||||
rows={6}
|
||||
focusBorderColor="green.400"
|
||||
name="comments"
|
||||
{...register("comments")}
|
||||
name="comment"
|
||||
{...register("comment")}
|
||||
fontSize="sm"
|
||||
type="textarea"
|
||||
size="md"
|
||||
placeholder={"Enter your comments...."}
|
||||
placeholder={"Enter your comment...."}
|
||||
rounded={"md"}
|
||||
resize={"none"}
|
||||
mb={2}
|
||||
/>
|
||||
{errors.comments ? (
|
||||
{errors.comment ? (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.comments.message}
|
||||
{errors.comment.message}
|
||||
</Text>
|
||||
) : (
|
||||
<Text fontSize="xs" color="gray.500">
|
||||
Maximum length should be 150 characters. You have entered{" "}
|
||||
{watch()?.comments?.length || 0} characters.
|
||||
{watch()?.comment?.length || 0} characters.
|
||||
</Text>
|
||||
)}
|
||||
</FormControl>
|
||||
|
||||
Reference in New Issue
Block a user