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