Router pipelines (hooks)
Aurelia's router uses a pipeline concept for processing navigation. You can add your own steps to this pipeline for things like authorization, loading indicators, or analytics tracking.
Steps are added using methods like addAuthorizeStep()
, addPreActivateStep()
, addPreRenderStep()
, or addPostRenderStep()
.
Here's an example of an authorization step:
In this example, the AuthorizeStep
checks if any of the routes being activated require authentication (by checking a hypothetical auth
property in the route's settings
). If authentication is required and the user isn't logged in, it redirects to a login page.
Last updated
Was this helpful?