Skip to content

Instantly share code, notes, and snippets.

@Klerith
Last active November 13, 2025 20:46
Show Gist options
  • Select an option

  • Save Klerith/e66cc78af7c8e137c144bb7b530f1adb to your computer and use it in GitHub Desktop.

Select an option

Save Klerith/e66cc78af7c8e137c144bb7b530f1adb to your computer and use it in GitHub Desktop.
Validaciones
const checkValidations = () => {
fieldErrors.value = {};
const result = productSchema.safeParse(newProduct.value);
if (!result.success) {
result.error.issues.forEach((issue) => {
const field = issue.path[0];
if (typeof field === 'string') {
fieldErrors.value[field] = issue.message;
}
});
return false;
}
// Si quieres, aquí puedes sobreescribir newProduct con los valores parseados
// newProduct.value = result.data;
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment