Skip to content

Instantly share code, notes, and snippets.

@victor-ponamariov
Last active August 26, 2023 20:01
Show Gist options
  • Save victor-ponamariov/ed5040b2339e68d0ea14d24198444cc5 to your computer and use it in GitHub Desktop.
Save victor-ponamariov/ed5040b2339e68d0ea14d24198444cc5 to your computer and use it in GitHub Desktop.
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')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment