mirror of
https://github.com/flarum/core.git
synced 2025-08-04 07:27:39 +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 {
|
||||
const map = {};
|
||||
|
||||
for (const key in routes) {
|
||||
if (!routes.hasOwnProperty(key)) continue;
|
||||
for (const name in routes) {
|
||||
if (!routes.hasOwnProperty(name)) continue;
|
||||
|
||||
const route = routes[key];
|
||||
const route = routes[name];
|
||||
|
||||
map[basePath + route.path] = {
|
||||
render() {
|
||||
return m(route.component, { routeName: key });
|
||||
view(vnode) {
|
||||
return m(route.component, { routeName: name, ...vnode.attrs });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user