2023-06-25 21:50:08 +00:00
|
|
|
import { fetchUserPosts, fetchAllPosts } from '../../src/posts';
|
2023-06-05 23:30:46 +00:00
|
|
|
|
2023-06-25 21:50:08 +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 {
|
2023-06-25 21:50:08 +00:00
|
|
|
posts,
|
2023-06-05 23:30:46 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-06-11 03:32:02 +00:00
|
|
|
export { getPageData };
|