Added actors pagination.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { fetchLatest, fetchUpcoming, fetchNew } from '../../src/scenes';
|
||||
import { fetchLatest, fetchUpcoming, fetchNew } from '#/src/scenes.js';
|
||||
|
||||
async function fetchScenes(scope, page, limit) {
|
||||
if (scope === 'new') {
|
||||
|
||||
@@ -1,33 +1,20 @@
|
||||
import { resolveRoute } from 'vike/routing';
|
||||
import { match } from 'path-to-regexp';
|
||||
// import { resolveRoute } from 'vike/routing'; // eslint-disable-line import/extensions
|
||||
|
||||
const path = '/updates/:scope?/:page?';
|
||||
const urlMatch = match(path, { decode: decodeURIComponent });
|
||||
|
||||
export default (pageContext) => {
|
||||
{
|
||||
const result = resolveRoute('/updates/@scope/@page', pageContext.urlPathname);
|
||||
const matched = urlMatch(pageContext.urlPathname);
|
||||
|
||||
if (result.match) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const result = resolveRoute('/updates/@scope', pageContext.urlPathname);
|
||||
|
||||
if (result.match) {
|
||||
result.routeParams.page = '1';
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const result = resolveRoute('/updates', pageContext.urlPathname);
|
||||
|
||||
if (result.match) {
|
||||
result.routeParams.scope = 'latest';
|
||||
result.routeParams.page = '1';
|
||||
|
||||
return result;
|
||||
}
|
||||
if (matched) {
|
||||
return {
|
||||
routeParams: {
|
||||
scope: matched.params.scope || 'latest',
|
||||
page: matched.params.page || '1',
|
||||
path,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user