16 lines
425 B
TypeScript
16 lines
425 B
TypeScript
import { unstable_cache } from 'next/cache'
|
|
import { getPayload } from 'payload'
|
|
import config from '@/payload.config'
|
|
|
|
export const fetchPrayers = unstable_cache(
|
|
async (): Promise<string[]> => {
|
|
const payload = await getPayload({ config })
|
|
const data = await payload.find({
|
|
collection: 'prayers',
|
|
limit: 0,
|
|
})
|
|
return data.docs.map((p) => p.text)
|
|
},
|
|
['prayers'],
|
|
{ tags: ['prayers'] },
|
|
)
|