-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.routing.ts
58 lines (54 loc) · 2.23 KB
/
app.routing.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { RoleGuard } from './services/role-guard.service';
import { RouterModule } from '@angular/router';
import { AuthGuard } from './services/auth-guard.service';
import { LoginComponent } from './components/auth/login.component';
import { RegisterComponent } from './components/auth/register.component';
import { GamesComponent } from './components/games/games.component';
import { ProfileComponent } from './components/users/profile.component';
import { ErrorComponent } from './components/error/error.component';
import { EditUserComponent } from './components/users/edit-user.component';
import { GamePageComponent } from './components/games/game-page.component';
import { ControlPanelComponent } from './components/games/control-panel.component';
import { CartComponent } from './components/users/cart.component';
import { CheckoutComponent } from './components/users/checkout.component';
import { SearchComponent } from './components/games/search.component';
import { AddGameComponent } from './components/games/add-game.component';
import { EditGameComponent } from './components/games/edit-game.component';
const appRoutes = [
{ path: 'login', component: LoginComponent },
{ path: 'register', component: RegisterComponent },
{ path: '', component: GamesComponent },
{
path: 'profile/:id',
component: ProfileComponent,
canActivate: [AuthGuard],
},
{ path: 'error/:id', component: ErrorComponent },
{
path: 'editProfile/:id',
component: EditUserComponent,
canActivate: [AuthGuard],
},
{ path: 'game/:id', component: GamePageComponent },
{
path: 'controlPanel',
component: ControlPanelComponent,
canActivate: [RoleGuard],
},
{ path: 'cart/:id', component: CartComponent, canActivate: [AuthGuard] },
{
path: 'checkout/:id',
component: CheckoutComponent,
canActivate: [AuthGuard],
},
{ path: 'search', component: SearchComponent, pathMatch: 'full' },
{ path: 'search/:name/:category', component: SearchComponent },
{ path: 'newGame', component: AddGameComponent, canActivate: [RoleGuard] },
{
path: 'editGame/:id',
component: EditGameComponent,
canActivate: [RoleGuard],
},
{ path: '**', redirectTo: 'error/404' },
];
export const routing = RouterModule.forRoot(appRoutes);