From 10d6d19c001c882f5026bdf73fbe5991bc86b710 Mon Sep 17 00:00:00 2001 From: Kimmo Puputti Date: Tue, 14 Feb 2017 09:50:08 +0200 Subject: [PATCH] Use the new matchPath instead of matchPattern --- src/routesConfiguration.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/routesConfiguration.js b/src/routesConfiguration.js index f3864e30..6af1a54b 100644 --- a/src/routesConfiguration.js +++ b/src/routesConfiguration.js @@ -1,10 +1,6 @@ import React from 'react'; import { find } from 'lodash'; -import { Redirect } from 'react-router-dom'; - -// This will change to `matchPath` soonish -import matchPattern from 'react-router-dom/matchPattern'; - +import { Redirect, matchPath } from 'react-router-dom'; import pathToRegexp from 'path-to-regexp'; import { AuthenticationPage, @@ -286,7 +282,7 @@ const matchRoutesToLocation = (routes, location, matchedRoutes = [], params = {} routes.forEach(route => { const { exactly = false } = route; - const match = !route.pattern ? true : matchPattern(route.pattern, location, exactly); + const match = !route.pattern || matchPath(location.pathname, route.pattern, { exact: exactly }); if (match) { matched.push(route);