From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Sign-up error handling

Sign-up error handling

OK, so now we're going to handle the errors better on the sign up page. So if we go to sign up, and I just want to show you what is happening now. So let's say that we try to use an e-mail that already exists, like admin at example.com. If I try and submit that, I get it doesn't let us, which is good, but it just says user was not registered. It doesn't let us know any other information, which obviously isn't very graceful. Now, the other type of error I want to show you is if we go to the sign-up page, so auth sign-up and then sign-up form, and we go to the name input and get rid of required, let's also get rid of the required on the e-mail and just temporarily set the type from e-mail to text. Because if we keep it as e-mail, it won't let us submit an empty field. And I want the UI to let us to submit an empty field to the action. So now if I were to try and submit, you know, leave the name and e-mail empty, remember the Zod schema says that name has to have three characters at…

Contents