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

27 lines
519 B
JavaScript

import { fetchActors } from '#/src/actors.js';
import { curateActorsQuery } from '#/src/web/actors.js';
export async function onBeforeRender(pageContext) {
const {
actors,
countries,
limit,
total,
} = await fetchActors(curateActorsQuery(pageContext.urlQuery), {
page: Number(pageContext.routeParams.page) || 1,
limit: Number(pageContext.urlParsed.search.limit) || 120,
});
return {
pageContext: {
title: 'actors',
pageProps: {
actors,
countries,
limit,
total,
},
},
};
}