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.
Hook up sign-in form - Next.js Tutorial
From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch
Hook up sign-in form
All right, guys, so now we're going to hook the sign up form or sign in form, sorry. We're going to hook that up to the action, the sign in with credentials action. And we're going to be using some new React hooks called use action state and use form status. So the three pages that I have open are the three files. I have the actions file open. We're not going to edit this or anything. We're not doing anything to it. But I just want to show you the action state that I'm talking about is an object with success and message. Whether it's successful and we get success true with this message, or it's not, success falls with this message. That's the action state. Now, in the Credentials sign-in form, I also have the page open, the sign-in page, because we're going to do some stuff there as well. But let's go into the Credentials sign-in form. And this is where we want to submit to that action. So we're going to bring that in. So let's say import sign-in with credentials. That's going to come…
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)
-
-
-
-
-
-
-
-
-
-
-
-
-