* Dispatches a navigation if the given error is (or wraps) a `RedirectCommand`. * * @returns Whether the error was a redirect.
(error: unknown, router: Router)
| 38 | * @returns Whether the error was a redirect. |
| 39 | */ |
| 40 | function triggerRedirectIfCommand(error: unknown, router: Router): boolean { |
| 41 | const redirect = unwrapRedirectCommand(error); |
| 42 | if (redirect === null) { |
| 43 | return false; |
| 44 | } |
| 45 | router.navigateByUrl(redirect.redirectTo, redirect.navigationBehaviorOptions); |
| 46 | return true; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Implementation of the router error boundary behavior. This is only included in the bundle when |
no test coverage detected