traxxx-web/pages/updates/+route.js

22 lines
491 B
JavaScript
Raw Normal View History

2024-01-04 00:49:16 +00:00
import { match } from 'path-to-regexp';
// import { resolveRoute } from 'vike/routing'; // eslint-disable-line import/extensions
2024-01-04 00:49:16 +00:00
const path = '/updates/:scope?/:page?';
const urlMatch = match(path, { decode: decodeURIComponent });
2024-01-04 00:49:16 +00:00
export default (pageContext) => {
const matched = urlMatch(pageContext.urlPathname);
if (matched) {
return {
routeParams: {
scope: matched.params.scope || 'latest',
page: matched.params.page || '1',
path,
},
};
}
return false;
};