12 lines
336 B
TypeScript
12 lines
336 B
TypeScript
import type { Page } from '../../payload-types'
|
|
|
|
export const fetchPages = async (): Promise<Page[]> => {
|
|
const pageRes: {
|
|
docs: Page[]
|
|
} = await fetch(`${process.env.NEXT_PUBLIC_CMS_URL}/api/pages?depth=0&limit=100`).then(res =>
|
|
res.json(),
|
|
) // eslint-disable-line function-paren-newline
|
|
|
|
return pageRes?.docs ?? []
|
|
}
|