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

12 lines
332 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 }) => {
2023-02-12 14:56:49 +01:00
const blogPostsResponse = await fetch(`/articles/pageSize/5.json`)
2023-01-17 20:57:28 +01:00
const blogPostsContent = await blogPostsResponse.json()
return {
latestPosts: blogPostsContent.posts.items,
}
}) satisfies LayoutLoad