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.

Get my orders action

Get my orders action

So, now we want to fetch the orders that are going to be displayed on this page, and that's going to be done through an action. So we're going to create that in this video, but I do want to have pagination, and one thing that I want to have is a constant with the page size, which is the number of orders we want on the page. And that's probably going to be somewhere around 12, but I'm going to set it to something small just for testing, so we can actually test our pagination. And that's going to go in our constants. So we want to go to lib constants index ts. And from here, let's go ahead and export const. We'll call it page underscore size, all caps. And then I'm going to set that equal to and then wrap number around process.env dot and then page underscore size. So that way, you can have the page size defined in the .env. And it will be casted as a number. Because by default, when you use process.env.whatever, it's going to be a string. And then I'm going to just say or to. So you…

Contents