2020-01-14 13:41:28 +01:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
import { Routes, RouterModule } from '@angular/router';
|
2020-05-19 12:49:06 +02:00
|
|
|
import {HomeComponent} from './home/home.component';
|
2020-06-19 08:43:22 +02:00
|
|
|
import {LoginService} from './services/login.service';
|
|
|
|
import {SampleComponent} from './sample/sample.component';
|
2020-05-22 09:36:50 +02:00
|
|
|
import {SamplesComponent} from './samples/samples.component';
|
2020-07-14 15:58:33 +02:00
|
|
|
import {DocumentationComponent} from './documentation/documentation.component';
|
2020-01-14 13:41:28 +01:00
|
|
|
|
|
|
|
|
2020-05-19 12:49:06 +02:00
|
|
|
const routes: Routes = [
|
2020-05-20 10:07:34 +02:00
|
|
|
{path: '', component: HomeComponent},
|
2020-05-22 12:52:17 +02:00
|
|
|
{path: 'home', component: HomeComponent},
|
2020-06-19 08:43:22 +02:00
|
|
|
{path: 'samples', component: SamplesComponent, canActivate: [LoginService]},
|
|
|
|
{path: 'samples/new', component: SampleComponent, canActivate: [LoginService]},
|
|
|
|
{path: 'samples/edit/:id', component: SampleComponent, canActivate: [LoginService]},
|
2020-07-14 15:58:33 +02:00
|
|
|
{path: 'documentation', component: DocumentationComponent},
|
2020-05-20 10:07:34 +02:00
|
|
|
|
|
|
|
// if not authenticated
|
|
|
|
{ path: '**', redirectTo: '' }
|
2020-05-19 12:49:06 +02:00
|
|
|
];
|
2020-01-14 13:41:28 +01:00
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
imports: [RouterModule.forRoot(routes)],
|
|
|
|
exports: [RouterModule]
|
|
|
|
})
|
|
|
|
export class AppRoutingModule { }
|