Skip to content

Commit

Permalink
fix: #57 fix domain validator must be required problem
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Apr 25, 2024
1 parent 1e05a27 commit 5767d45
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client/utils/validator.ts
Expand Up @@ -19,6 +19,11 @@ export const hostnameValidator: Validator = (rule, value, callback) => {

export const domainValidator: Validator = (rule, value, callback) => {
try {
if (!rule.required && !value) {
callback();
return;
}

z.string().regex(hostnameRegex).parse(value);
callback();
} catch (err) {
Expand Down

0 comments on commit 5767d45

Please sign in to comment.