Last active
November 13, 2025 20:46
-
-
Save Klerith/e66cc78af7c8e137c144bb7b530f1adb to your computer and use it in GitHub Desktop.
Validaciones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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