refactor(router): minor refactoring

This commit is contained in:
vsavkin 2016-06-15 07:55:28 -07:00
parent 3bd0ce291e
commit 3683fb6886

View File

@ -89,6 +89,7 @@ function expandWildCardWithParamsAgainstRouteUsingRedirect(route: Route): UrlSeg
return new UrlSegment(newPaths, {}); return new UrlSegment(newPaths, {});
} }
} }
function expandRegularPathWithParamsAgainstRouteUsingRedirect( function expandRegularPathWithParamsAgainstRouteUsingRedirect(
segment: UrlSegment, routes: Route[], route: Route, paths: UrlPathWithParams[], segment: UrlSegment, routes: Route[], route: Route, paths: UrlPathWithParams[],
outlet: string): UrlSegment { outlet: string): UrlSegment {
@ -169,9 +170,10 @@ function applyRedirectCommands(
posParams: {[k: string]: UrlPathWithParams}): UrlPathWithParams[] { posParams: {[k: string]: UrlPathWithParams}): UrlPathWithParams[] {
if (redirectTo.startsWith('/')) { if (redirectTo.startsWith('/')) {
const parts = redirectTo.substring(1).split('/'); const parts = redirectTo.substring(1).split('/');
throw new GlobalRedirect(createPaths(redirectTo, parts, paths, posParams)); return createPaths(redirectTo, parts, paths, posParams);
} else { } else {
return createPaths(redirectTo, redirectTo.split('/'), paths, posParams); const parts = redirectTo.split('/');
return createPaths(redirectTo, parts, paths, posParams);
} }
} }