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.

Delete orders

Delete orders

OK, so now we want to go ahead and add the functionality to delete in order. And this is going to consist of creating the action, which is really simple. And then we're going to have the button. And I just want to show you the final version. Because in addition to the button, we have this dialogue. And this is from ShadCN. So we also want to set this up. And we're going to use Use Transition. So if we delete, you'll see that this will change to deleting real quick. And there's a couple other things as well. Now, one thing I want to mention, and I'll try to remember to put a note in the video where we did this, but in the utils, so where are we, lib utils, and in the format error, this actually shouldn't be asynchronous. I think I just got carried away with all the async functions we were adding. That shouldn't be asynchronous. And this will cause a TypeScript error in what we're doing next if you leave it asynchronous. All right, now I want to start off by creating the action to…

Contents