Skip to content

Commit

Permalink
Fix phone number validation and add number validation to schema
Browse files Browse the repository at this point in the history
  • Loading branch information
metowolf committed Mar 13, 2024
1 parent f3a787d commit d4b28f5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/const/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Joi from 'joi'
import libphonenumber from 'google-libphonenumber'

const checkPhone = (phone) => {
let phoneStr = phone
let phoneStr = `${phone}`
if (/^\+\d+ /.test(phoneStr)) {
phoneStr = phoneStr.replace(/^\+\d+ /, '')
}
Expand All @@ -23,7 +23,8 @@ const schema = Joi.object({
return helper.message("phone is incorrect")
}
return value
})
}),
Joi.number()
).required(),
url: Joi.string().uri().optional(),
workEmail: Joi.array().items(Joi.string().email()).optional()
Expand Down

0 comments on commit d4b28f5

Please sign in to comment.