10 lines
308 B
TypeScript
10 lines
308 B
TypeScript
import { error } from '@sveltejs/kit';
|
|
import { getPostBySlug } from '$lib/blog/posts';
|
|
import type { PageLoad } from './$types';
|
|
|
|
export const load: PageLoad = ({ params }) => {
|
|
const post = getPostBySlug(params.slug);
|
|
if (!post) throw error(404, 'Статья не найдена');
|
|
return { post };
|
|
};
|