Fix loading articles on layout
This commit is contained in:
parent
dad51ddb33
commit
fd719937d9
@ -1,12 +1,10 @@
|
||||
import type { LayoutLoad } from './$types';
|
||||
import type { LayoutLoad } from './$types'
|
||||
|
||||
export const load = (async ({ fetch, url }) => {
|
||||
const blogPostsResponse = await fetch(`/blog/articles/pageSize/5.json`)
|
||||
export const load = (async ({ fetch }) => {
|
||||
const blogPostsResponse = await fetch(`/blog/articles/pageSize/5`)
|
||||
const blogPostsContent = await blogPostsResponse.json()
|
||||
|
||||
return {
|
||||
latestPosts: blogPostsContent.posts.items,
|
||||
// TODO Check if not bugged FIXME
|
||||
segment: '',
|
||||
}
|
||||
}) satisfies LayoutLoad
|
||||
|
@ -55,7 +55,7 @@ export async function getBlogListing(paginationQuery: PaginationQuery) {
|
||||
const filteredContents = pipe(
|
||||
sortBy<PostContent>(prop('date')),
|
||||
(items) => reverse(items),
|
||||
filter<typeof contents[0]>((article) => article.published),
|
||||
filter<(typeof contents)[0]>((article) => article.published),
|
||||
filterAndCount(paginationQuery)
|
||||
)(contents)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user