16 lines
460 B
TypeScript
16 lines
460 B
TypeScript
import { PUBLIC_API_BASE } from '$env/static/public';
|
|
import type { PaginatedWithCursor, Post } from '$lib/mabel-types';
|
|
import type { PageLoad } from './$types';
|
|
|
|
export const load = (async ({ parent }) => {
|
|
const { site } = await parent();
|
|
|
|
const data = await fetch(
|
|
`${PUBLIC_API_BASE}/collections/${site.name}/${site.default_collection}/posts`
|
|
);
|
|
|
|
return {
|
|
pages: (await data.json()) as PaginatedWithCursor<Post, string>
|
|
};
|
|
}) satisfies PageLoad;
|