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:
@@ -18,12 +18,12 @@ async function DocsPage() {
|
||||
const client = await createCmsClient();
|
||||
const { t } = await createI18nServerInstance();
|
||||
|
||||
const docs = await client.getContentItems({
|
||||
const { items } = await client.getContentItems({
|
||||
collection: 'documentation',
|
||||
});
|
||||
|
||||
// Filter out any docs that have a parentId, as these are children of other docs
|
||||
const cards = docs.filter((item) => !item.parentId);
|
||||
const cards = items.filter((item) => !item.parentId);
|
||||
|
||||
return (
|
||||
<PageBody>
|
||||
@@ -33,7 +33,7 @@ async function DocsPage() {
|
||||
subtitle={t('marketing:documentationSubtitle')}
|
||||
/>
|
||||
|
||||
<div className={'flex flex-col items-center'}>
|
||||
<div className={'container mx-auto flex flex-col items-center'}>
|
||||
<DocsCards cards={cards} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user