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 search form

Admin search form

So now what I want to do is make this search work. And I want it to search products, orders, and users based on whatever page we're on. If we're on the orders page, then I want to search orders. And with orders, we're just going to search the user. So if I want to find any orders from John Doe, I could type in John, and those would show up. I also want to put the name, the buyer name, in this table. Now, as far as how this is going to work, This is going to submit to one of these three pages, depending on the path name we're currently on. And it's going to add a question mark query like that. So if I run that, that's not going to work for orders because we haven't added that in our action to get all orders. It's not looking for a query. However, products is. We do have that. So if I do query equals polo, that actually works. So we have to do more with the users and orders than we do with products, because we already have the query implemented here. But let's go ahead and make a…

Contents