Update getContentItems to return total count and items
The changes involved modifying the implementation of `getContentItems` across multiple files, specifically in the CMS-related codebase. This method now returns an object containing the total count of items and the items themselves. The updates also included necessary adjustments in the code where `getContentItems` is called to accommodate the new structure of the returned result.
This commit is contained in:
@@ -23,7 +23,7 @@ async function BlogPage({ searchParams }: { searchParams: { page: string } }) {
|
||||
const limit = 10;
|
||||
const offset = page * limit;
|
||||
|
||||
const posts = await cms.getContentItems({
|
||||
const { items: posts, total } = await cms.getContentItems({
|
||||
collection: 'posts',
|
||||
limit,
|
||||
offset,
|
||||
|
||||
Reference in New Issue
Block a user