feat(poc): add page parameter for collection

This commit is contained in:
Björn Meyer
2023-07-10 09:57:15 +02:00
parent ed79b5b025
commit fc39573c57
3 changed files with 5 additions and 3 deletions

View File

@@ -31,11 +31,12 @@ export default async function CategoryPage({
params: { collection: string };
searchParams?: { [key: string]: string | string[] | undefined };
}) {
const { sort } = searchParams as { [key: string]: string };
const { sort, page } = searchParams as { [key: string]: string };
const { sortKey, reverse } = sorting.find((item) => item.slug === sort) || defaultSort;
const products = await getCollectionProducts({
collection: params.collection,
page: page ? parseInt(page) : 1,
sortKey,
reverse
});