Skip to content

Commit

Permalink
Improve redirect handling
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Nov 7, 2016
1 parent 0204070 commit bb8f6cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default class Redirect {
if (typeof to === 'function') {
toLocation = to(match);
} else {
const { matcher, params } = match;
toLocation = matcher.format(to, params);
const { router, params } = match;
toLocation = router.matcher.format(to, params);
}

throw new RedirectException(toLocation);
Expand Down
3 changes: 2 additions & 1 deletion src/createBaseRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default function createBaseRouter({
createLocation,
isActive,
addTransitionHook,
matcher,
};

this.childContext = {
Expand Down Expand Up @@ -115,7 +116,7 @@ export default function createBaseRouter({
const augmentedMatch = {
...match,
routes,
matcher, // For e.g. Redirect to format pattern.
match, // For symmetry with withRouter.
router: this.router, // Convenience access for route components.
context: matchContext,
};
Expand Down

0 comments on commit bb8f6cf

Please sign in to comment.