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