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.

Update order buttons (COD)

Update order buttons (COD)

So in the last video, we created some actions to mark the orders as paid and mark them as delivered. And now what I want to do is have some buttons here for the admins to do that. And this is mostly for just cash on deliveries, but just gives you the option also as an admin to just mark it as paid or delivered. Maybe you want to give someone something for free and you just want to mark it off as paid. All right, so let's jump into the Orders page. So we're going to go to App, and then Root. So remember, the Orders isn't in the admin, that the actual order page. It's just slash order. So it's in the root, and then order ID, because it's a specific order, and then page.tsx. And we need to make sure that the user is an admin. And so what I'd like to do is get the session on this page, which is server-side rendered, and then pass it in, if we're admin or not, pass it into the orders details table, because that's where the actual button is going to go. So let's do that. Let's go above the…

Contents