Skip to content

Commit

Permalink
fix(redirect): do not use Promise.reject on redirect
Browse files Browse the repository at this point in the history
Closes #480
  • Loading branch information
fkleuver authored and davismj committed May 12, 2018
1 parent c08a318 commit 487c33d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/navigation-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export class BuildNavigationPlanStep {
run(navigationInstruction: NavigationInstruction, next: Function) {
return _buildNavigationPlan(navigationInstruction)
.then(plan => {
if (plan instanceof Redirect) {
return next.cancel(plan);
}
navigationInstruction.plan = plan;
return next();
}).catch(next.cancel);
Expand All @@ -33,7 +36,7 @@ export function _buildNavigationPlan(instruction: NavigationInstruction, forceLi
redirectLocation += '?' + instruction.queryString;
}

return Promise.reject(new Redirect(redirectLocation));
return Promise.resolve(new Redirect(redirectLocation));
});
}

Expand Down

0 comments on commit 487c33d

Please sign in to comment.