blog/frontend/src/routes/post/+page.server.ts
SquidSpirit a73c3c3354
Some checks failed
Frontend CI / build (push) Failing after 46s
BLOG-45 feat: improve efficiency with ssr
2025-07-24 08:03:15 +08:00

13 lines
396 B
TypeScript

import { PostListEventType } from '$lib/post/adapter/presenter/postListBloc';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ locals }) => {
const { postListBloc } = locals;
const state = await postListBloc.dispatch({ event: PostListEventType.PostListLoadedEvent });
return {
dehydratedData: state.data?.map((post) => post.dehydrate())
};
};