Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag-#77: From validation #83

Closed

Conversation

MrBlackGhostt
Copy link

@MrBlackGhostt MrBlackGhostt commented Dec 15, 2023

Summary

Use the React-hook-form and Zod for the form validation

Description

1.Install Dependencies:
First, make sure you have react-hook-form and zod installed. You can install them using npm or yarn:

2.Create Form Schema with Zod:
Define your form schema using Zod. This includes specifying the validation rules and error messages for each field.

3.Use New Dependencies:
use the React-hook-form & zod for the input and validation

Images

Before
Screenshot 2023-12-15 at 8 31 08 PM

After

Screenshot 2023-12-15 at 8 31 17 PM

Prerequisites

Copy link

vercel bot commented Dec 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wanderlust ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2023 2:52pm
wanderlust-backend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 15, 2023 2:52pm

@krishnaacharyaa
Copy link
Owner

@MrBlackGhostt we know the error, kindly check the discord

Copy link
Owner

@krishnaacharyaa krishnaacharyaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image Functionalities are not perfectly working. Title though it is 3 words, The error isn't resolved,

And categories selection is broken, kindly address the comments and this, and also resolve the merge conflicts by rebasing your branch with the latest main branch

}),
authorName: z.string().refine((value) => value.trim().length >= 3 && value.trim().length <= 15, {
message: 'Hey, Your name should be more than 5 letters.',
}),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use "your name should be" emphasis on should, becuase he can be Raj,
We can be like "C'mon your name cannot be less than 3 characters" ( if its less than 3 letters);
if greater than 15 say "Hey isn't it too big of a name, can you limit it to 15 characters" or improvise on this

}),
categories: z.array(z.string()).refine((value) => value.length <= 3, {
message: 'Easy there! Select up to 3 categories.',
}),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done the changes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now I see the Sarcism here 😅

@krishnaacharyaa krishnaacharyaa marked this pull request as draft December 15, 2023 13:59
@krishnaacharyaa
Copy link
Owner

image image

Observations.

  1. Categories selection is broken, selection is shown only after the button is cilcked
  2. If you give everything right at the first go it doesn't let you create post, and doesn't even compliant
  3. The dynamic error handling for the images and categories isn't worknig
  4. Typo in "C'ome on! Your name cannot be less than 3 characters."
  5. There are conflicts with the main branch, kindly rebase.

Request review once all of these is handled, if you feel this is too much of a task, seek help from others in the community discord,
Thank you.

MrBlackGhostt pushed a commit to MrBlackGhostt/wanderlust that referenced this pull request Dec 17, 2023
@krishnaacharyaa
Copy link
Owner

If we are not working on this anymore, kindly close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Centralised Error Handling
3 participants