Skip to content

Instantly share code, notes, and snippets.

View victor-ponamariov's full-sized avatar

Victor victor-ponamariov

View GitHub Profile
@victor-ponamariov
victor-ponamariov / VeeValidate.js
Last active August 26, 2023 20:01
Useful JS snippets
// How to validate a field that depends on another variable, rather than a field in <Form>, in vee-validate 4
return yup.object().shape({
// Set empty array in .when
businessTripPurpose: yup.string().when([], {
is: () => props.trip.reason.type === 'business_trip',
then: schema => schema.required('The field is required')
})