church-website/src/fetch/config.ts
2026-03-09 11:16:32 +01:00

13 lines
No EOL
318 B
TypeScript

import { Menu } from '@/payload-types'
export const fetchMenu = async (): Promise<Menu> => {
const rep = await fetch(
"http://localhost:3000/api/globals/menu",
{ next: { tags: ['menu'] } } // cache fetch result
);
if (!rep.ok) {
throw new Error("Could not fetch menu")
}
return await rep.json()
}