michalvankodev-site/src/routes/+layout.ts

12 lines
337 B
TypeScript
Raw Normal View History

2023-01-31 19:27:36 +01:00
import type { LayoutLoad } from './$types'
export const prerender = true
2023-01-17 20:57:28 +01:00
2023-01-31 19:27:36 +01:00
export const load = (async ({ fetch }) => {
const blogPostsResponse = await fetch(`/blog/articles/pageSize/5.json`)
2023-01-17 20:57:28 +01:00
const blogPostsContent = await blogPostsResponse.json()
return {
latestPosts: blogPostsContent.posts.items,
}
}) satisfies LayoutLoad