Skip to content

Commit

Permalink
adding redirect to route path description
Browse files Browse the repository at this point in the history
  • Loading branch information
feeloor committed Nov 19, 2019
1 parent 67ca9be commit 49ffe7d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/backend/utils/parse-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export function parseRoutes(router: any): Route {
isAux: false,
specificity: null,
data: null,
hash: null,
hash: null
};

return root;
}

function assignChildrenToParent(parentPath, children): [any] {
return children.map((child) => {
return children.map(child => {
const childName = childRouteName(child);
const childDescendents: [any] = child._loadedConfig ? child._loadedConfig.routes : child.children;

Expand All @@ -46,7 +46,7 @@ function assignChildrenToParent(parentPath, children): [any] {
name: childName,
path: `${parentPath ? parentPath : ''}/${pathFragment}`.split('//').join('/'),
isAux: isAuxRoute,
children: [],
children: []
};

if (childDescendents) {
Expand All @@ -58,7 +58,7 @@ function assignChildrenToParent(parentPath, children): [any] {
if (child.data.hasOwnProperty(el)) {
routeConfig.data.push({
key: el,
value: child.data[el],
value: child.data[el]
});
}
}
Expand All @@ -71,11 +71,11 @@ function assignChildrenToParent(parentPath, children): [any] {
function childRouteName(child): string {
if (child.component) {
return child.component.name;
}
else if (child.loadChildren) {
} else if (child.loadChildren) {
return `${child.path} [Lazy]`;
}
else {
} else if (child.redirectTo) {
return `${child.path} -> redirecting to -> "${child.redirectTo}"`;
} else {
return 'no-name-route';
}
}

0 comments on commit 49ffe7d

Please sign in to comment.