validation bug fix
This commit was merged in pull request #34.
This commit is contained in:
@@ -6,25 +6,25 @@ import { InputCompOne } from "..";
|
|||||||
// To get the validation schema
|
// To get the validation schema
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
bvn: Yup.string()
|
bvn: Yup.string()
|
||||||
|
.required("BVN is required")
|
||||||
.test("no-e", "Invalid number", (value:any) => {
|
.test("no-e", "Invalid number", (value:any) => {
|
||||||
if (value && /^[0-9]/.test(value) == false) {
|
if (value && /^[0-9]*$/.test(value) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.min(11, "must be 11 digits")
|
.min(11, "must be 11 digits")
|
||||||
.max(11, "must be 11 digits")
|
.max(11, "must be 11 digits"),
|
||||||
.required("BVN is required"),
|
|
||||||
otp: Yup.string()
|
otp: Yup.string()
|
||||||
|
.required("OTP is required")
|
||||||
.test("no-e", "Invalid number", (value:any) => {
|
.test("no-e", "Invalid number", (value:any) => {
|
||||||
if (value && /^[0-9]/.test(value) == false) {
|
if (value && /^[0-9]*$/.test(value) == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.min(5, "must be 5 digits")
|
.min(5, "must be 5 digits")
|
||||||
.max(5, "must be 5 digits")
|
.max(5, "must be 5 digits"),
|
||||||
.required("OTP is required"),
|
|
||||||
// .test("no-e", "must be 11 characters", (value:any) => {
|
// .test("no-e", "must be 11 characters", (value:any) => {
|
||||||
// if (value.length < 11) {
|
// if (value.length < 11) {
|
||||||
// return false;
|
// return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user