bitwarden-estensione-browser/src/app/app-routing.module.ts

75 lines
2.8 KiB
TypeScript
Raw Normal View History

2018-06-05 05:10:41 +02:00
import { NgModule } from '@angular/core';
import {
RouterModule,
Routes,
} from '@angular/router';
2018-06-08 23:08:19 +02:00
import { FrontendLayoutComponent } from './layouts/frontend-layout.component';
import { OrganizationLayoutComponent } from './layouts/organization-layout.component';
import { UserLayoutComponent } from './layouts/user-layout.component';
2018-06-05 21:02:53 +02:00
import { HintComponent } from './accounts/hint.component';
import { LockComponent } from './accounts/lock.component';
2018-06-05 21:02:53 +02:00
import { LoginComponent } from './accounts/login.component';
import { RegisterComponent } from './accounts/register.component';
import { TwoFactorComponent } from './accounts/two-factor.component';
2018-06-10 05:33:12 +02:00
import { ExportComponent } from './tools/export.component';
import { ImportComponent } from './tools/import.component';
2018-06-21 00:16:20 +02:00
import { PasswordGeneratorComponent } from './tools/password-generator.component';
2018-06-10 05:33:12 +02:00
import { ToolsComponent } from './tools/tools.component';
2018-06-05 05:10:41 +02:00
import { VaultComponent } from './vault/vault.component';
2018-06-10 04:02:45 +02:00
import { UnauthGuardService } from './services/unauth-guard.service';
import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
2018-06-05 05:10:41 +02:00
const routes: Routes = [
{
2018-06-08 23:08:19 +02:00
path: '',
2018-06-10 04:02:45 +02:00
component: FrontendLayoutComponent,
2018-06-08 23:08:19 +02:00
children: [
2018-06-10 04:02:45 +02:00
{ path: '', pathMatch: 'full', component: LoginComponent, canActivate: [UnauthGuardService] },
{ path: '2fa', component: TwoFactorComponent, canActivate: [UnauthGuardService] },
{ path: 'register', component: RegisterComponent, canActivate: [UnauthGuardService] },
{ path: 'hint', component: HintComponent, canActivate: [UnauthGuardService] },
{ path: 'lock', component: LockComponent },
2018-06-08 23:08:19 +02:00
],
},
{
path: '',
2018-06-10 04:02:45 +02:00
component: UserLayoutComponent,
2018-06-08 23:08:19 +02:00
children: [
2018-06-10 04:02:45 +02:00
{ path: 'vault', component: VaultComponent, canActivate: [AuthGuardService] },
2018-06-10 05:33:12 +02:00
{
path: 'tools',
component: ToolsComponent,
children: [
2018-06-21 00:16:20 +02:00
{ path: '', pathMatch: 'full', redirectTo: 'generator' },
2018-06-10 05:33:12 +02:00
{ path: 'import', component: ImportComponent, canActivate: [AuthGuardService] },
{ path: 'export', component: ExportComponent, canActivate: [AuthGuardService] },
2018-06-21 00:16:20 +02:00
{ path: 'generator', component: PasswordGeneratorComponent, canActivate: [AuthGuardService] },
2018-06-10 05:33:12 +02:00
],
},
2018-06-08 23:08:19 +02:00
],
},
{
path: 'organization/:organizationId',
component: OrganizationLayoutComponent,
children: [
2018-06-10 04:02:45 +02:00
{ path: 'vault', component: VaultComponent, canActivate: [AuthGuardService] },
2018-06-08 23:08:19 +02:00
],
2018-06-05 05:10:41 +02:00
},
2018-06-08 23:08:19 +02:00
{ path: '**', redirectTo: '' },
2018-06-05 05:10:41 +02:00
];
@NgModule({
imports: [RouterModule.forRoot(routes, {
useHash: true,
/*enableTracing: true,*/
})],
exports: [RouterModule],
})
export class AppRoutingModule { }