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 and display users

Get and display users

So we're able to to get and manage the orders in the admin area as well as the products now We want to do the same with the users, which obviously this doesn't work right now So a couple things we need to do one. We need an action to get the users. So why don't we start there? So we'll go to libs action user action and then down at the bottom. Let's say we want to We want to get all Get all the users and let's export Asynchronous function called getAllUsers, and then this is going to, we're using pagination just like with the other resources, so this will take in an object with the limit which will be set to the page size by default, which you want to bring in, make sure that's coming in from the constants. Just check that, yeah, so it's coming in from constants. And then we also want the page number, so just pass in page. And then for the types, so for the type, it'll be an object with limit, which will be optional and will be a number. And then the page, which will also be a number.…

Contents