From bbac3e67bc80cd26f796eef10a6cf5dbb9090cde Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Wed, 13 Jun 2018 22:09:10 +0200 Subject: [PATCH] Simplify routing configuration. --- src/operations/operation.module.ts | 12 ++++-------- src/operations/operation.states.ts | 16 +++++++--------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/operations/operation.module.ts b/src/operations/operation.module.ts index 7226281..1d60a6c 100644 --- a/src/operations/operation.module.ts +++ b/src/operations/operation.module.ts @@ -24,20 +24,16 @@ import { OperationEditComponent } from './operationEdit.component'; import { OperationDeleteModalComponent } from './operationDeleteModal.component'; import { OperationFormComponent } from './operationForm.component'; import { OperationEditModalComponent } from './operationEditModal.component'; -import { OperationListState } from './operation.states'; -import { OperationNewState } from './operation.states'; -import { OperationEditState } from './operation.states'; +import { OperationRoutes } from './operation.states'; @NgModule({ imports: [ HttpClientModule, CommonModule, ReactiveFormsModule, - RouterModule.forChild([ - OperationListState, - OperationNewState, - OperationEditState - ]), + RouterModule.forChild( + OperationRoutes + ), NgLoggerModule, ToastrModule, NgbModule, diff --git a/src/operations/operation.states.ts b/src/operations/operation.states.ts index 035dc46..5a59005 100644 --- a/src/operations/operation.states.ts +++ b/src/operations/operation.states.ts @@ -1,21 +1,19 @@ // vim: set tw=80 ts=2 sw=2 sts=2 : +import { Routes } from '@angular/router'; + import { OperationListComponent } from './operationList.component'; import { OperationNewComponent } from './operationNew.component'; import { OperationEditComponent } from './operationEdit.component'; -export const OperationListState = { +export const OperationRoutes: Routes = [{ path: 'account/:accountId/operations', component: OperationListComponent, - onSameUrlNavigation: 'reload' -}; - -export const OperationNewState = { + //onSameUrlNavigation: 'reload' +}, { path: 'account/:accountId/operations/new', component: OperationNewComponent, -}; - -export const OperationEditState = { +}, { path: 'account/:accountId/operations/:operationId/edit', component: OperationEditComponent, -}; +}];