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

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…

Contents