45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Routes } from '@angular/router';
|
|
import { LoginComponent } from './components/login/login';
|
|
import { DashboardComponent } from './components/dashboard/dashboard';
|
|
import { AuthGuard } from './guards/auth-guard';
|
|
import { AdminGuard } from './guards/auth-guard';
|
|
import { AutorizacionesPorFechaComponent } from './components/autorizaciones-por-fecha/autorizaciones-por-fecha';
|
|
import { AutorizacionesComponent } from './components/autorizaciones/autorizaciones';
|
|
import { UsuariosComponent } from './components/usuarios/usuarios';
|
|
|
|
|
|
export const routes: Routes = [
|
|
// base: siempre al login
|
|
{ path: '', pathMatch: 'full', redirectTo: 'login' },
|
|
|
|
{ path: 'login', component: LoginComponent },
|
|
|
|
{
|
|
path: 'dashboard',
|
|
component: DashboardComponent,
|
|
canActivate: [AuthGuard],
|
|
},
|
|
|
|
{
|
|
path: 'autorizaciones',
|
|
component: AutorizacionesComponent,
|
|
canActivate: [AuthGuard],
|
|
},
|
|
|
|
{
|
|
path: 'autorizaciones-por-fecha',
|
|
component: AutorizacionesPorFechaComponent,
|
|
canActivate: [AuthGuard, AdminGuard],
|
|
},
|
|
|
|
{
|
|
path: 'usuarios',
|
|
component: UsuariosComponent,
|
|
canActivate: [AuthGuard]
|
|
},
|
|
|
|
// cualquier cosa rara → dashboard
|
|
{ path: '**', redirectTo: 'dashboard' },
|
|
|
|
];
|