router
router copied to clipboard
Add support for multiple actions on a route
In some cases it would be useful to be able to run a sequence of actions for a route, like:
- Authenticate
- Import module
Maybe action
could accept an array that it runs in order. If any item returns a command, it would stop there.
{
path: '/foo',
component: 'x-foo',
action: [authGuard, () => import('./components/x-foo')]
}
Suggestion: Add a helper method (say sequence()
) that can be imported from the @vaadin/router
package and used like:
{
path: '/foo',
component: 'x-foo',
action: sequence(authGuard, () => import('./components/x-foo'))
}