32 lines
595 B
JavaScript
32 lines
595 B
JavaScript
import { fetchScenesById } from '#/src/scenes.js';
|
|
|
|
function getTitle(scene) {
|
|
if (scene.title) {
|
|
return scene.title;
|
|
}
|
|
|
|
if (scene.actors.length > 0) {
|
|
return `Scene with ${scene.actors.map((actor) => actor.name).join(', ')}`;
|
|
}
|
|
|
|
return 'Scene';
|
|
}
|
|
|
|
export async function onBeforeRender(pageContext) {
|
|
const [scene] = await fetchScenesById([Number(pageContext.routeParams.sceneId)], {
|
|
reqUser: pageContext.user,
|
|
includeAssets: true,
|
|
includePartOf: true,
|
|
actorStashes: true,
|
|
});
|
|
|
|
return {
|
|
pageContext: {
|
|
title: getTitle(scene),
|
|
pageProps: {
|
|
scene,
|
|
},
|
|
},
|
|
};
|
|
}
|