31 lines
576 B
JavaScript
31 lines
576 B
JavaScript
|
import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */
|
||
|
import { fetchSceneRevisions } from '#/src/scenes.js';
|
||
|
|
||
|
export async function onBeforeRender(pageContext) {
|
||
|
if (!pageContext.user || pageContext.user.role === 'user') {
|
||
|
throw render(404);
|
||
|
}
|
||
|
|
||
|
const {
|
||
|
revisions,
|
||
|
actors,
|
||
|
tags,
|
||
|
movies,
|
||
|
} = await fetchSceneRevisions(null, {
|
||
|
isFinalized: false,
|
||
|
limit: 50,
|
||
|
}, pageContext.user);
|
||
|
|
||
|
return {
|
||
|
pageContext: {
|
||
|
title: pageContext.routeParams.section,
|
||
|
pageProps: {
|
||
|
revisions,
|
||
|
actors,
|
||
|
tags,
|
||
|
movies,
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
}
|