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

23 lines
483 B
JavaScript

import { fetchScenes } from '#/src/scenes.js';
export async function onBeforeRender(pageContext) {
const { scenes, limit, total } = await fetchScenes({
scope: pageContext.routeParams.scope || 'latest',
}, {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 30,
aggregate: false,
});
return {
pageContext: {
title: pageContext.routeParams.scope,
pageProps: {
scenes,
limit,
total,
},
},
};
}