From d992ce87a9ca5807a4a84ec39d6ff0644d544998 Mon Sep 17 00:00:00 2001 From: Nino Righi Date: Tue, 29 Mar 2022 13:11:25 +0000 Subject: [PATCH] Merged PR 1144: #2962 Keycard Login Fix #2962 Keycard Login Fix --- .../scan/src/lib/native.scan-adapter.ts | 7 +- apps/isa-app/src/app/app-routing.module.ts | 144 +++++++++--------- apps/isa-app/src/app/app.module.ts | 5 - 3 files changed, 75 insertions(+), 81 deletions(-) diff --git a/apps/adapter/scan/src/lib/native.scan-adapter.ts b/apps/adapter/scan/src/lib/native.scan-adapter.ts index b958812c6..52d0ea6a1 100644 --- a/apps/adapter/scan/src/lib/native.scan-adapter.ts +++ b/apps/adapter/scan/src/lib/native.scan-adapter.ts @@ -21,10 +21,9 @@ export class NativeScanAdapter implements ScanAdapter { } scan(): Observable { - return this.nativeContainerService.openScanner('remissionContainer').pipe( - filter((result) => result.status === 'SUCCESS'), - map((result) => result.data), - take(1) + return this.nativeContainerService.openScanner('scanLogin').pipe( + filter((result) => result.status !== 'IN_PROGRESS'), + map((result) => result.data) ); } } diff --git a/apps/isa-app/src/app/app-routing.module.ts b/apps/isa-app/src/app/app-routing.module.ts index 3577e1620..f05e982bf 100644 --- a/apps/isa-app/src/app/app-routing.module.ts +++ b/apps/isa-app/src/app/app-routing.module.ts @@ -19,91 +19,91 @@ import { ShellComponent, ShellModule } from './shell'; const routes: Routes = [ { - // path: '', - // canActivate: [IsAuthenticatedGuard], - // children: [ - // { path: '', - canActivate: [InitStoreGuard], + canActivate: [IsAuthenticatedGuard], children: [ { - path: 'kunde', - component: ShellComponent, + path: '', canActivate: [InitStoreGuard], children: [ { - path: 'dashboard', - loadChildren: () => import('@page/dashboard').then((m) => m.DashboardModule), + path: 'kunde', + component: ShellComponent, + canActivate: [InitStoreGuard], + children: [ + { + path: 'dashboard', + loadChildren: () => import('@page/dashboard').then((m) => m.DashboardModule), + }, + { + path: 'product', + loadChildren: () => import('@page/catalog').then((m) => m.PageCatalogModule), + canActivate: [CanActivateProductGuard], + }, + { + path: ':processId/product', + loadChildren: () => import('@page/catalog').then((m) => m.PageCatalogModule), + canActivate: [CanActivateProductWithProcessIdGuard], + resolve: { processId: ProcessIdResolver }, + }, + { + path: 'customer', + loadChildren: () => import('@page/customer').then((m) => m.PageCustomerModule), + canActivate: [CanActivateCustomerGuard], + }, + { + path: ':processId/customer', + loadChildren: () => import('@page/customer').then((m) => m.PageCustomerModule), + canActivate: [CanActivateCustomerWithProcessIdGuard], + resolve: { processId: ProcessIdResolver }, + }, + { + path: 'cart', + loadChildren: () => import('@page/checkout').then((m) => m.PageCheckoutModule), + canActivate: [CanActivateCartGuard], + }, + { + path: ':processId/cart', + loadChildren: () => import('@page/checkout').then((m) => m.PageCheckoutModule), + canActivate: [CanActivateCartWithProcessIdGuard], + }, + { + path: 'goods/out', + loadChildren: () => import('@page/goods-out').then((m) => m.GoodsOutModule), + canActivate: [CanActivateGoodsOutGuard], + }, + { path: '**', redirectTo: 'dashboard', pathMatch: 'full' }, + ], + resolve: { section: CustomerSectionResolver }, }, { - path: 'product', - loadChildren: () => import('@page/catalog').then((m) => m.PageCatalogModule), - canActivate: [CanActivateProductGuard], + path: 'filiale', + component: ShellComponent, + children: [ + { + path: 'task-calendar', + loadChildren: () => import('@page/task-calendar').then((m) => m.PageTaskCalendarModule), + canActivate: [CanActivateTaskCalendarGuard], + }, + { + path: 'goods/in', + loadChildren: () => import('@page/goods-in').then((m) => m.GoodsInModule), + canActivate: [CanActivateGoodsInGuard], + }, + { + path: 'remission', + loadChildren: () => import('@page/remission').then((m) => m.PageRemissionModule), + canActivate: [CanActivateRemissionGuard], + }, + { path: '**', redirectTo: 'task-calendar', pathMatch: 'full' }, + ], + resolve: { section: BranchSectionResolver }, }, - { - path: ':processId/product', - loadChildren: () => import('@page/catalog').then((m) => m.PageCatalogModule), - canActivate: [CanActivateProductWithProcessIdGuard], - resolve: { processId: ProcessIdResolver }, - }, - { - path: 'customer', - loadChildren: () => import('@page/customer').then((m) => m.PageCustomerModule), - canActivate: [CanActivateCustomerGuard], - }, - { - path: ':processId/customer', - loadChildren: () => import('@page/customer').then((m) => m.PageCustomerModule), - canActivate: [CanActivateCustomerWithProcessIdGuard], - resolve: { processId: ProcessIdResolver }, - }, - { - path: 'cart', - loadChildren: () => import('@page/checkout').then((m) => m.PageCheckoutModule), - canActivate: [CanActivateCartGuard], - }, - { - path: ':processId/cart', - loadChildren: () => import('@page/checkout').then((m) => m.PageCheckoutModule), - canActivate: [CanActivateCartWithProcessIdGuard], - }, - { - path: 'goods/out', - loadChildren: () => import('@page/goods-out').then((m) => m.GoodsOutModule), - canActivate: [CanActivateGoodsOutGuard], - }, - { path: '**', redirectTo: 'dashboard', pathMatch: 'full' }, + { path: '**', redirectTo: 'kunde', pathMatch: 'full' }, ], - resolve: { section: CustomerSectionResolver }, }, - { - path: 'filiale', - component: ShellComponent, - children: [ - { - path: 'task-calendar', - loadChildren: () => import('@page/task-calendar').then((m) => m.PageTaskCalendarModule), - canActivate: [CanActivateTaskCalendarGuard], - }, - { - path: 'goods/in', - loadChildren: () => import('@page/goods-in').then((m) => m.GoodsInModule), - canActivate: [CanActivateGoodsInGuard], - }, - { - path: 'remission', - loadChildren: () => import('@page/remission').then((m) => m.PageRemissionModule), - canActivate: [CanActivateRemissionGuard], - }, - { path: '**', redirectTo: 'task-calendar', pathMatch: 'full' }, - ], - resolve: { section: BranchSectionResolver }, - }, - { path: '**', redirectTo: 'kunde', pathMatch: 'full' }, ], }, - // ], - // }, ]; @NgModule({ diff --git a/apps/isa-app/src/app/app.module.ts b/apps/isa-app/src/app/app.module.ts index c2f9a203d..2c9be951a 100644 --- a/apps/isa-app/src/app/app.module.ts +++ b/apps/isa-app/src/app/app.module.ts @@ -36,11 +36,6 @@ export function _appInitializerFactory(config: Config, auth: AuthService) { return async () => { await config.init(); await auth.init(); - - // Remove this for testing with DevScannerModule - if (!auth.isAuthenticated()) { - auth.login(); - } }; }