1
0
mirror of https://github.com/flarum/core.git synced 2025-08-04 15:37:51 +02:00

common: change mapRoutes from using resolver, and pass vnode attrs

This commit is contained in:
David Sevilla Martin
2020-05-03 16:04:38 -04:00
parent 0302a2c5a7
commit b180cd9daf

View File

@@ -9,14 +9,14 @@ import { RouteDefs } from 'mithril';
export default function mapRoutes(routes: object, basePath: string = ''): RouteDefs { export default function mapRoutes(routes: object, basePath: string = ''): RouteDefs {
const map = {}; const map = {};
for (const key in routes) { for (const name in routes) {
if (!routes.hasOwnProperty(key)) continue; if (!routes.hasOwnProperty(name)) continue;
const route = routes[key]; const route = routes[name];
map[basePath + route.path] = { map[basePath + route.path] = {
render() { view(vnode) {
return m(route.component, { routeName: key }); return m(route.component, { routeName: name, ...vnode.attrs });
}, },
}; };
} }