fix: #57 fix domain validator must be required problem
This commit is contained in:
parent
1e05a273a0
commit
5767d4595b
@ -19,6 +19,11 @@ export const hostnameValidator: Validator = (rule, value, callback) => {
|
|||||||
|
|
||||||
export const domainValidator: Validator = (rule, value, callback) => {
|
export const domainValidator: Validator = (rule, value, callback) => {
|
||||||
try {
|
try {
|
||||||
|
if (!rule.required && !value) {
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
z.string().regex(hostnameRegex).parse(value);
|
z.string().regex(hostnameRegex).parse(value);
|
||||||
callback();
|
callback();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user