From bc83b6782bb934a15d0bd0034f1166b0cd414fa7 Mon Sep 17 00:00:00 2001 From: Arman Ozak Date: Wed, 17 Jun 2020 19:04:37 +0300 Subject: [PATCH] feat: add route provider to account config --- .../account/config/src/providers/index.ts | 1 + .../config/src/providers/route.provider.ts | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 npm/ng-packs/packages/account/config/src/providers/index.ts create mode 100644 npm/ng-packs/packages/account/config/src/providers/route.provider.ts diff --git a/npm/ng-packs/packages/account/config/src/providers/index.ts b/npm/ng-packs/packages/account/config/src/providers/index.ts new file mode 100644 index 0000000000..fe08efba8c --- /dev/null +++ b/npm/ng-packs/packages/account/config/src/providers/index.ts @@ -0,0 +1 @@ +export * from './route.provider'; diff --git a/npm/ng-packs/packages/account/config/src/providers/route.provider.ts b/npm/ng-packs/packages/account/config/src/providers/route.provider.ts new file mode 100644 index 0000000000..2deb086b10 --- /dev/null +++ b/npm/ng-packs/packages/account/config/src/providers/route.provider.ts @@ -0,0 +1,39 @@ +import { eLayoutType, RoutesService } from '@abp/ng.core'; +import { APP_INITIALIZER } from '@angular/core'; +import { eAccountRouteNames } from '../enums/route-names'; + +export const ACCOUNT_ROUTE_PROVIDERS = [ + { provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService], multi: true }, +]; + +export function configureRoutes(routes: RoutesService) { + return () => { + routes.add([ + { + path: '/account', + name: eAccountRouteNames.Account, + invisible: true, + layout: eLayoutType.application, + order: 1, + }, + { + path: '/account/login', + name: eAccountRouteNames.Login, + parentName: eAccountRouteNames.Account, + order: 1, + }, + { + path: '/account/register', + name: eAccountRouteNames.Register, + parentName: eAccountRouteNames.Account, + order: 2, + }, + { + path: '/account/manage-profile', + name: eAccountRouteNames.ManageProfile, + parentName: eAccountRouteNames.Account, + order: 3, + }, + ]); + }; +}