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

30 lines
641 B
JavaScript
Raw Normal View History

import { fetchActors } from '#/src/actors.js';
import { curateActorsQuery } from '#/src/web/actors.js';
export async function onBeforeRender(pageContext) {
const {
actors,
countries,
cupRange,
limit,
total,
} = await fetchActors(curateActorsQuery(pageContext.urlQuery), {
page: Number(pageContext.routeParams.page) || 1,
2024-01-04 00:49:16 +00:00
limit: Number(pageContext.urlParsed.search.limit) || 120,
order: pageContext.urlParsed.search.order?.split('.') || ['likes', 'desc'],
2024-03-21 01:54:05 +00:00
}, pageContext.user);
return {
pageContext: {
title: 'actors',
pageProps: {
actors,
countries,
cupRange,
limit,
total,
},
},
};
}