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 - Next.js Tutorial
From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Section intro2m 57s
-
(Locked)
Prisma user-related models9m 45s
-
(Locked)
Seed user data7m
-
(Locked)
NextAuth setup17m 31s
-
(Locked)
NextAuth catch all API route4m 12s
-
(Locked)
Sign-in and sign-out server actions8m 27s
-
(Locked)
Auth layout and sign-in page6m 58s
-
(Locked)
Credentials sign-in form6m 39s
-
(Locked)
Hook up sign-in form9m 28s
-
(Locked)
Callback URL redirect4m 26s
-
(Locked)
User button and sign-out11m 48s
-
(Locked)
Signup Zod schema and action8m 15s
-
(Locked)
Sign-up page and form7m 35s
-
(Locked)
Sign-up error handling12m 40s
-
(Locked)
Customize token with JWT callback8m 19s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-
-
-