import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { authGuard } from './auth.guard';
import { PageLoginComponent } from './page-login/page-login.component';
import { PageInfoComponent } from './page-info/page-info.component';
import { PageRigistComponent } from './page-rigist/page-rigist.component';
import { PageUserComponent } from './page-user/page-user.component';
import { PageUserDetailComponent } from './page-user-detail/page-user-detail.component';

const routes: Routes = [
  { path: "login", component: PageLoginComponent },
  { path: "userDetail", component: PageUserDetailComponent },
  { path: "register", component: PageRigistComponent },
  {
    path: "info", component: PageInfoComponent,
    canActivate: [authGuard]
  },
  {
    path: "user", component: PageUserComponent,
    canActivate: [authGuard]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class UserRoutingModule { }
