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