blinkk / rootjs

Root.js – A full-featured web development tool with a built-in CMS.
https://rootjs.dev
MIT License
5 stars 0 forks source link

CMS client utility for making batch requests #367

Open stevenle opened 1 month ago

stevenle commented 1 month ago

Description

When rendering a page, client may need to specify multiple content docs for the CMS to fetch and render. The CMS client should be able to make the firestore fetch in a single batch request.

Example (not final):

const batch = cmsClient.batch({mode: 'draft | published'});
batch.getDoc('Pages/index');
batch.listDocs('BlogPosts', {query: ...});
batch.getTranslations('BlogPostsMetadata');
const res = await batch.execute();