Added actor profile revisions.
This commit is contained in:
@@ -1 +0,0 @@
|
||||
export default '/admin/@section/*';
|
||||
24
pages/admin/revisions/actors/+onBeforeRender.js
Normal file
24
pages/admin/revisions/actors/+onBeforeRender.js
Normal file
@@ -0,0 +1,24 @@
|
||||
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,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
19
pages/admin/revisions/actors/+route.js
Normal file
19
pages/admin/revisions/actors/+route.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { match } from 'path-to-regexp';
|
||||
|
||||
const path = '/admin/:section/:domain(actors)';
|
||||
const urlMatch = match(path, { decode: decodeURIComponent });
|
||||
|
||||
export default (pageContext) => {
|
||||
const matched = urlMatch(pageContext.urlPathname);
|
||||
|
||||
if (matched) {
|
||||
return {
|
||||
routeParams: {
|
||||
section: matched.params.section,
|
||||
domain: matched.params.domain,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
19
pages/admin/revisions/scenes/+route.js
Normal file
19
pages/admin/revisions/scenes/+route.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { match } from 'path-to-regexp';
|
||||
|
||||
const path = '/admin/:section/:domain(scenes)';
|
||||
const urlMatch = match(path, { decode: decodeURIComponent });
|
||||
|
||||
export default (pageContext) => {
|
||||
const matched = urlMatch(pageContext.urlPathname);
|
||||
|
||||
if (matched) {
|
||||
return {
|
||||
routeParams: {
|
||||
section: matched.params.section,
|
||||
domain: matched.params.domain,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
Reference in New Issue
Block a user