import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from './dashboard/dashboard.component';
import { LoginComponent } from './login/login.component';
import { AuthGuard } from './guards/auth.guard';
import { AppComponent } from './app.component';

export const routes: Routes = [


          { path: 'login', component: LoginComponent },
          { path: '', component: DashboardComponent },

          {
              path: '',
              runGuardsAndResolvers: 'always',
              canActivate: [AuthGuard],
              children: [
                { path: 'dashboard', component: DashboardComponent },
              ]
          },
          { path: '**', redirectTo: '', pathMatch: 'full' }
];

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