2022-04-16 10:43:45 +00:00
|
|
|
import { fetchBlogPostBySlug } from '$lib';
|
|
|
|
|
import type { LoadInput } from '@sveltejs/kit';
|
|
|
|
|
|
|
|
|
|
export const get = async ({ params }: LoadInput) => {
|
|
|
|
|
const { slug } = params;
|
2022-04-16 10:50:44 +00:00
|
|
|
|
2022-04-16 10:43:45 +00:00
|
|
|
const post = await fetchBlogPostBySlug(slug);
|
|
|
|
|
|
|
|
|
|
if (!post) {
|
|
|
|
|
return {
|
|
|
|
|
status: 404,
|
|
|
|
|
body: {}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
status: 200,
|
|
|
|
|
body: { post }
|
|
|
|
|
};
|
|
|
|
|
};
|