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.

Admin orders page and action

Admin orders page and action

Okay, so our dashboard or overview, whatever you want to call it, this is looking pretty good. So now we want to get to the resources here. We want to be able to list out all the products, orders, and users and be able to delete them as well. So let's start with the orders. Obviously this page isn't here, but we're going to add it. Before we add the page though, I just want to create the action to get all orders because we don't have an action that does that, right? If we look at our order actions, we have one to create an order. We have one to get an order by ID, create PayPal. We have all the PayPal stuff. And then update the order to paid. We have get my orders, which will get the logged in users orders. But we want to get all because we're an admin. So down at the very bottom, let's say this is to get all orders. So we're going to export a function, and we'll call it get all orders. Now this is going to take in an object, and it's going to have a limit, which I'm going to set a…

Contents