2022-12-30 22:32:49 +05:30
|
|
|
import type { PageServerLoad } from "./$types";
|
2023-01-01 04:51:53 +05:30
|
|
|
import fetchApi from "$lib/ghost";
|
2022-12-30 22:32:49 +05:30
|
|
|
|
2023-01-01 04:51:53 +05:30
|
|
|
export const load = (async ({ params }) => {
|
|
|
|
const data = await fetchApi("posts/slug/" + params.title);
|
2022-12-30 22:32:49 +05:30
|
|
|
|
2023-01-03 23:28:24 +05:30
|
|
|
const allPosts = await fetchApi("posts");
|
|
|
|
|
2023-01-01 04:51:53 +05:30
|
|
|
return {
|
2023-01-03 23:28:24 +05:30
|
|
|
post: data.posts[0],
|
|
|
|
allPosts: allPosts
|
2023-01-01 04:51:53 +05:30
|
|
|
};
|
|
|
|
}) satisfies PageServerLoad;
|