18 lines
436 B
JavaScript
18 lines
436 B
JavaScript
import { getPost, getPosts } from '$lib/server/db/post';
|
|
|
|
|
|
/** @type {import('./$types').PageServerLoad} */
|
|
export async function load({ url }) {
|
|
const result = await getPosts();
|
|
|
|
const glance = url.searchParams.get('glance');
|
|
const glanceID = glance ? parseInt(glance) : null
|
|
|
|
const glancePost = glanceID ? await getPost(glanceID, { withMetrics: true }) : null;
|
|
|
|
return {
|
|
posts: result,
|
|
glancePost: glancePost
|
|
};
|
|
}
|