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

13 lines
368 B
TypeScript
Raw Normal View History

2023-01-17 20:57:28 +01:00
import type { LayoutLoad } from './$types';
export const load = (async ({ fetch, url }) => {
const blogPostsResponse = await fetch(`/blog/articles/pageSize/5.json`)
const blogPostsContent = await blogPostsResponse.json()
return {
latestPosts: blogPostsContent.posts.items,
// TODO Check if not bugged FIXME
segment: '',
}
}) satisfies LayoutLoad