fix(utils): remove optional params in routes ending with index (#7845)

This commit is contained in:
Ahad Birang 2020-08-04 17:33:00 +04:30 committed by GitHub
parent ec534d05b9
commit 2eb42876a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,9 @@ function cleanChildrenRoutes (routes, isChild = false, routeNameSplitter = '-',
routes.forEach((route) => { routes.forEach((route) => {
route.path = isChild ? route.path.replace('/', '') : route.path route.path = isChild ? route.path.replace('/', '') : route.path
if (route.path.includes('?')) { if (route.path.includes('?')) {
if (route.name.endsWith(`${routeNameSplitter}index`)) {
route.path = route.path.replace(/\?$/, '')
}
const names = route.name.replace(regExpParentRouteName, '').split(routeNameSplitter) const names = route.name.replace(regExpParentRouteName, '').split(routeNameSplitter)
const paths = route.path.split('/') const paths = route.path.split('/')
if (!isChild) { if (!isChild) {