22 lines
444 B
JavaScript
22 lines
444 B
JavaScript
import { match } from 'path-to-regexp';
|
|
|
|
const path = '/admin/:section/:domain(scenes)/:page?';
|
|
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,
|
|
page: matched.params.page || '1',
|
|
path,
|
|
},
|
|
};
|
|
}
|
|
|
|
return false;
|
|
};
|