mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 10:19:22 +03:00
27 lines
795 B
TypeScript
27 lines
795 B
TypeScript
import yup from 'validators';
|
|
|
|
const UpdateUserContactsSchema = yup.object().shape({
|
|
phone_number: yup
|
|
.string()
|
|
.isMobileValid(['en-US', 'ru-RU'], { strictMode: true })
|
|
.transform(val => (!val ? null : val))
|
|
.nullable(true),
|
|
twitter_id: yup
|
|
.string()
|
|
.matches(/(^|[^@\w])@(\w{1,15})\b/, 'Twitter username is not valid')
|
|
.transform(val => (!val ? null : val))
|
|
.nullable(true),
|
|
telegram_id: yup
|
|
.string()
|
|
.matches(/(^|[^@\w])@(\w{1,64})\b/, 'Telegram username is not valid')
|
|
.transform(val => (!val ? null : val))
|
|
.nullable(true),
|
|
vk_id: yup
|
|
.string()
|
|
.matches(/^([a-zA-Z0-9_]){1,64}$/, 'VKontakte username is not valid')
|
|
.transform(val => (!val ? null : val))
|
|
.nullable(true),
|
|
});
|
|
|
|
export default UpdateUserContactsSchema;
|