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 }) => {
|
export const load = (async ({ fetch }) => {
|
||||||
const blogPostsResponse = await fetch(`/blog/articles/pageSize/5.json`)
|
const blogPostsResponse = await fetch(`/blog/articles/pageSize/5`)
|
||||||
const blogPostsContent = await blogPostsResponse.json()
|
const blogPostsContent = await blogPostsResponse.json()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
latestPosts: blogPostsContent.posts.items,
|
latestPosts: blogPostsContent.posts.items,
|
||||||
// TODO Check if not bugged FIXME
|
|
||||||
segment: '',
|
|
||||||
}
|
}
|
||||||
}) satisfies LayoutLoad
|
}) satisfies LayoutLoad
|
||||||
|
@ -55,7 +55,7 @@ export async function getBlogListing(paginationQuery: PaginationQuery) {
|
|||||||
const filteredContents = pipe(
|
const filteredContents = pipe(
|
||||||
sortBy<PostContent>(prop('date')),
|
sortBy<PostContent>(prop('date')),
|
||||||
(items) => reverse(items),
|
(items) => reverse(items),
|
||||||
filter<typeof contents[0]>((article) => article.published),
|
filter<(typeof contents)[0]>((article) => article.published),
|
||||||
filterAndCount(paginationQuery)
|
filterAndCount(paginationQuery)
|
||||||
)(contents)
|
)(contents)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user