Skip to content

Commit

Permalink
fix(route-recognizer): respect explicit href during generation
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jul 7, 2016
1 parent 117613f commit 335f2a7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/route-recognizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,17 @@ export class RouteRecognizer {
* @returns The generated absolute path and query string.
*/
generate(name: string, params: Object): string {
let routeParams = Object.assign({}, params);

let route = this.names[name];
if (!route) {
throw new Error(`There is no route named ${name}`);
}

let handler = route.handlers[0].handler;
if (handler.href) {
return handler.href;
}

let routeParams = Object.assign({}, params);
let segments = route.segments;
let consumed = {};
let output = '';
Expand Down

0 comments on commit 335f2a7

Please sign in to comment.