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.
Signup Zod schema and action - Next.js Tutorial
From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch
Signup Zod schema and action
All right. So now we're going to create this sign up functionality. So we have a little bit to do, just like we did with the sign in. This sign up page, obviously we want this to show a form with the name, e-mail, password. We'll also have a confirmed password. So the form will be the last thing. What I want to do first is the action and also set up the schema, the Zod schema for validation. So let's start off with that. I'm going to go into lib and then validators TS. And let's just copy the sign in form schema. And let's just put a comment here. We'll say schema for signing up a user. And we're going to change the name of this to sign up form schema. And we're going to keep the e-mail and password. Let's add in a name, so z.string. And I'm also going to do a min characters. We'll do three. And then a message, name must be at least three characters. All right, and then we want to confirm password. So I'm going to copy that line down and then change this to, let's say, confirm…
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)
-
-
-
-
-
-
-
-
-
-
-
-
-