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.

Profile form submission

Profile form submission

All right, guys, so we're going to wrap this up. We just need to take care of the submit for the form here. So in the profile form, if you're following along, you should have on submit. And that gets passed into the form dot handle submit. And with React hook form, we then have access to the values here. And then I'm just going to infer the type from the update profile schema. So we'll set that to z dot infer. And then we'll say type of and update profile schema. And then get rid of this return. And what we're going to want to do is call the action. And I'm going to put the result in a res variable. So let's say await, which means we have to make this a sync. And we're going to await on the action, which is update profile. Make sure that gets brought in. And then just pass in the values object. So then we want to check to see if it's not successful. So if not res.success, then we're going to return a toast. And make sure I think we brought in use toast, right? Yeah, and make sure you…

Contents