Skip to content

Instantly share code, notes, and snippets.

@kaufd
Forked from sergeysova/routes.js
Created November 7, 2019 09:50
Show Gist options
  • Select an option

  • Save kaufd/ad49e6bcb52e6542112f93cebda9441e to your computer and use it in GitHub Desktop.

Select an option

Save kaufd/ad49e6bcb52e6542112f93cebda9441e to your computer and use it in GitHub Desktop.
const routes = [
{
name: "auth.login",
path: "/login",
component: LoginPage,
guards: [checkAuthn({ auth: false, redirectTo: "home" })],
},
{
name: "transactions.list",
path: "/transactions",
component: TransactionsPage,
guargs: [
checkAuthn({ auth: true, redirectTo: "auth.login", method: "replace" }),
checkRoles(["admin", "user"]),
],
children: [
{
name: 'transactions.foo',
path: '/foo',
component: DemoPage,
// guards from parents applies
},
]
},
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment