Skip to content

Commit 1266b9b

Browse files
committed
custom fields
1 parent 532159b commit 1266b9b

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/router.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ export interface Route {
2727
action?: Action,
2828
status?: number,
2929
to?: string,
30-
childs?: Childs
30+
childs?: Childs,
31+
[index: string]: any;
3132
}
3233
export interface initParams {
3334
path: string,
@@ -114,11 +115,9 @@ export default class Router extends React.Component<Props, State> {
114115
static buildRoutes(routes) {
115116
if (!Array.isArray(routes)) routes = routes.props.children;
116117
return deepMap(routes, route => {
117-
const result: Route = {};
118-
if (route.props.path) result.path = route.props.path;
119-
if (route.props.action) result.action = route.props.action;
120-
if (route.props.status) result.status = route.props.status;
121-
if (route.props.to) result.to = route.props.to;
118+
const result: Route = {
119+
...route.props
120+
};
122121
if (route.props.children) result.childs = Array.isArray(route.props.children) ? route.props.children : [route.props.children];
123122
return result;
124123
});

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ query-string@^4.3.2:
2424
strict-uri-encode "^1.0.0"
2525

2626
27-
version "0.5.6"
28-
resolved "https://registry.yarnpkg.com/router-async/-/router-async-0.5.6.tgz#b9f05c62ef2f1659e6ce988200b53a366f73a3e2"
27+
version "0.5.7"
28+
resolved "https://registry.yarnpkg.com/router-async/-/router-async-0.5.7.tgz#b37afe7a41f764da2021c0de32873f082619cce0"
2929
dependencies:
3030
path-to-regexp "^1.7.0"
3131
query-string "^4.3.2"

0 commit comments

Comments
 (0)