traxxx-web/pages/admin/revisions/actors/+onBeforeRender.js

25 lines
514 B
JavaScript
Raw Normal View History

import { render } from 'vike/abort'; /* eslint-disable-line import/extensions */
2024-10-22 01:12:42 +00:00
import { fetchActorRevisions } from '#/src/actors.js';
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, {
isFinalized: false,
limit: 50,
}, pageContext.user);
return {
pageContext: {
title: pageContext.routeParams.section,
pageProps: {
revisions,
},
},
};
}