Changed routing for series to use library/:id/series/:id so that we can always validate a user has library access.
This commit is contained in:
parent
4836936b12
commit
bdf382ca14
4 changed files with 58 additions and 4 deletions
|
|
@ -4,6 +4,8 @@ import { HomeComponent } from './home/home.component';
|
|||
import { LibraryDetailComponent } from './library-detail/library-detail.component';
|
||||
import { LibraryComponent } from './library/library.component';
|
||||
import { SeriesDetailComponent } from './series-detail/series-detail.component';
|
||||
import { LibraryAccessGuard } from './_guards/library-access.guard';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{path: '', component: HomeComponent},
|
||||
|
|
@ -12,8 +14,15 @@ const routes: Routes = [
|
|||
loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule)
|
||||
},
|
||||
{path: 'library', component: LibraryComponent},
|
||||
{path: 'library/:id', component: LibraryDetailComponent}, // NOTE: Should I put a guard up to prevent unauthorized access to libraries and series?
|
||||
{path: 'series/:id', component: SeriesDetailComponent},
|
||||
{
|
||||
path: '',
|
||||
runGuardsAndResolvers: 'always',
|
||||
canActivate: [LibraryAccessGuard],
|
||||
children: [
|
||||
{path: 'library/:id', component: LibraryDetailComponent},
|
||||
{path: 'library/:id/series/:id', component: SeriesDetailComponent},
|
||||
]
|
||||
},
|
||||
{path: '**', component: HomeComponent, pathMatch: 'full'}
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue