2024-10-06 00:45:56 +00:00
|
|
|
import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */
|
2024-10-22 01:12:42 +00:00
|
|
|
import { fetchActorRevisions } from '#/src/actors.js';
|
2024-10-06 00:45:56 +00:00
|
|
|
|
|
|
|
export async function onBeforeRender(pageContext) {
|
|
|
|
if (!pageContext.user || pageContext.user.role === 'user') {
|
|
|
|
throw render(404);
|
|
|
|
}
|
|
|
|
|
|
|
|
const {
|
|
|
|
revisions,
|
2024-10-22 01:12:42 +00:00
|
|
|
} = await fetchActorRevisions(null, {
|
2024-10-06 00:45:56 +00:00
|
|
|
isFinalized: false,
|
|
|
|
limit: 50,
|
|
|
|
}, pageContext.user);
|
|
|
|
|
|
|
|
return {
|
|
|
|
pageContext: {
|
|
|
|
title: pageContext.routeParams.section,
|
|
|
|
pageProps: {
|
|
|
|
revisions,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|