1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Add much better logic to normalize routes.

This commit is contained in:
Arunoda Susiripala 2017-04-11 15:12:22 +05:30
parent b5bd0daf62
commit c077ebe7ba

View file

@ -17,7 +17,8 @@ export default class PageLoader {
throw new Error('Route name should start with a "/"')
}
return route.replace(/index$/, '')
if (route === '/') return route
return route.replace(/(\/)?(index)?$/, '')
}
loadPage (route) {