traxxx-web/pages/updates/+onBeforeRender.js

27 lines
667 B
JavaScript
Raw Normal View History

import { fetchScenes } from '#/src/scenes.js';
import { curateScenesQuery } from '#/src/web/scenes.js';
export async function onBeforeRender(pageContext) {
const { scenes, limit, total } = await fetchScenes(await curateScenesQuery({
...pageContext.urlQuery,
scope: pageContext.routeParams.scope || 'latest',
2024-03-17 02:55:26 +00:00
isShowcased: true,
tagFilter: pageContext.tagFilter,
}), {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 30,
aggregate: false,
}, pageContext.user);
return {
pageContext: {
title: pageContext.routeParams.scope,
pageProps: {
scenes,
limit,
total,
},
},
};
}