37 lines
860 B
TypeScript
37 lines
860 B
TypeScript
import {NgModule} from '@angular/core';
|
|
import {RouterModule, Routes} from '@angular/router';
|
|
import {LoginComponent} from './login/login.component';
|
|
import {InfoComponent} from './info/info.component';
|
|
import {LogoutComponent} from './logout/logout.component';
|
|
import {AngularFireAuthGuard, redirectUnauthorizedTo} from '@angular/fire/auth-guard';
|
|
|
|
|
|
const routes: Routes = [
|
|
{
|
|
path: '',
|
|
redirectTo: 'info',
|
|
pathMatch: 'full'
|
|
},
|
|
{
|
|
path: 'login',
|
|
component: LoginComponent
|
|
},
|
|
{
|
|
path: 'logout',
|
|
component: LogoutComponent
|
|
},
|
|
{
|
|
path: 'info',
|
|
component: InfoComponent,
|
|
canActivate: [AngularFireAuthGuard],
|
|
data: {authGuardPipe: () => redirectUnauthorizedTo(['user', 'login'])}
|
|
},
|
|
];
|
|
|
|
@NgModule({
|
|
imports: [RouterModule.forChild(routes)],
|
|
exports: [RouterModule]
|
|
})
|
|
export class UserRoutingModule {
|
|
}
|