Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
Fixed: better support of react-router routes that don't have slashes
Browse files Browse the repository at this point in the history
Closes #941
  • Loading branch information
MoOx committed Feb 23, 2017
1 parent 2f49e02 commit 7fc3ad2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/static/routes-to-urls/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ const collection: PhenomicCollection = [
const routes = (
<Route component={ Noop }>
<Route path="/author/:author" component={ Noop } />
<Route path="/blog" component={ Noop }>
<Route path="/category/:category" component={ Noop } />
<Route path="blog" component={ Noop }>
<Route path="category/:category" component={ Noop } />
<Route path="/tag/:tag" component={ Noop } />
</Route>
<Route path="/key/:key" component={ Noop } />
<Route path="key/:key" component={ Noop } />
<Route path="*" component={ Noop } />
</Route>
)
Expand Down
3 changes: 2 additions & 1 deletion src/static/routes-to-urls/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { createRoutes, formatPattern } from "react-router"
import colors from "chalk"
import urlJoin from "url-join"

import arrayUnique from "../../_utils/array-unique"

Expand All @@ -15,7 +16,7 @@ const flattenRoute = (route) => {
route.childRoutes.forEach((route) => {
routesUrls = [
...routesUrls,
...flattenRoute(route).map((r) => root + r),
...flattenRoute(route).map((r) => urlJoin(root, r)),
]
})
}
Expand Down

0 comments on commit 7fc3ad2

Please sign in to comment.