From 2ac18a39ed14899f00428c4a01630152edbbb6f0 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Thu, 27 Aug 2020 00:32:34 -0400 Subject: [PATCH] Make routeName available to pages again --- js/src/common/components/Page.js | 2 +- js/src/common/utils/mapRoutes.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/src/common/components/Page.js b/js/src/common/components/Page.js index f260233df..16db7624f 100644 --- a/js/src/common/components/Page.js +++ b/js/src/common/components/Page.js @@ -11,7 +11,7 @@ export default class Page extends Component { super.oninit(vnode); app.previous = app.current; - app.current = new PageState(this.constructor); + app.current = new PageState(this.constructor, { routeName: vnode.attrs.routeName }); app.drawer.hide(); app.modal.close(); diff --git a/js/src/common/utils/mapRoutes.js b/js/src/common/utils/mapRoutes.js index 16c3651d9..abcf41315 100644 --- a/js/src/common/utils/mapRoutes.js +++ b/js/src/common/utils/mapRoutes.js @@ -13,7 +13,11 @@ export default function mapRoutes(routes, basePath = '') { for (const key in routes) { const route = routes[key]; - map[basePath + route.path] = route.component; + map[basePath + route.path] = { + render() { + return m(route.component, { routeName: key }); + }, + }; } return map;