Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. src/validators
  2. import * as Yup from 'yup'
  3. import isValidCpf from '@brazilian-utils/is-valid-cpf';
  4.  
  5. export default Yup.object().shape({
  6. document: Yup.string().required('O campo de CNPJ é obrigatório.'),
  7. businessName: Yup.string().required('O campo de Razão Social é obrigatório.'),
  8. users: Yup.array().of(Yup.object({
  9. name: Yup.string().required('O campo de nome é obrigatório.'),
  10. cpf: Yup
  11. .string()
  12. .test('test-name', 'Digite um CPF válido.', value => isValidCpf(value))
  13. .required('O campo de CPF é obrigatório.'),
  14. email: Yup.string().email('Por favor, informe um e-mail válido.').required('O campo de e-mail é obrigatório.'),
  15. phone: Yup.string().required('O campo de telefone é obrigatório.'),
  16. }))
  17. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement