This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Block} from 'payload/types'; | |
const createRecursiveLinksBlock = (current = 0, maxDepth = 3): Block => { | |
if (current < maxDepth - 1) { | |
current++; | |
return { | |
slug: `Level ${current}`, | |
fields: [ | |
{ | |
name: 'name', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qs from 'qs'; | |
export const cmsURL = "cms URL without the / at the end"; | |
export const apiKey = "yourAPIkey"; | |
export async function getDocuments (collectionName: string, whereQuery?) { | |
if (whereQuery) { | |
const stringifiedQuery = qs.stringify({ | |
where: whereQuery | |
}, { addQueryPrefix: true }); |