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:
@@ -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 });
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user