From b180cd9daf14e53a88187ec21b8caa303734be82 Mon Sep 17 00:00:00 2001 From: David Sevilla Martin Date: Sun, 3 May 2020 16:04:38 -0400 Subject: [PATCH] common: change mapRoutes from using resolver, and pass vnode attrs --- js/src/common/utils/mapRoutes.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/src/common/utils/mapRoutes.ts b/js/src/common/utils/mapRoutes.ts index 442f99c3b..35d8b7005 100644 --- a/js/src/common/utils/mapRoutes.ts +++ b/js/src/common/utils/mapRoutes.ts @@ -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 }); }, }; }