shack/pages/index/index.page.server.js

14 lines
277 B
JavaScript
Raw Normal View History

import { fetchUserPosts, fetchAllPosts } from '../../src/posts';
2023-06-05 23:30:46 +00:00
async function getPageData(pageContext) {
const posts = pageContext.session.user
? await fetchUserPosts(pageContext.session.user)
: await fetchAllPosts();
2023-06-05 23:30:46 +00:00
return {
posts,
2023-06-05 23:30:46 +00:00
};
}
2023-06-11 03:32:02 +00:00
export { getPageData };