mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 15:40:11 +01:00
refactor(auth): move auth into core module
This commit is contained in:
parent
75dd743244
commit
671056ddd9
4 changed files with 32 additions and 30 deletions
|
|
@ -1,17 +1,34 @@
|
|||
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NbAuthModule, NbDummyAuthProvider } from '@nebular/auth';
|
||||
|
||||
import { throwIfAlreadyLoaded } from './module-import-guard';
|
||||
import { DataModule } from './data/data.module';
|
||||
|
||||
const NB_CORE_PROVIDERS = [
|
||||
...DataModule.forRoot().providers,
|
||||
...NbAuthModule.forRoot({
|
||||
providers: {
|
||||
email: {
|
||||
service: NbDummyAuthProvider,
|
||||
config: {
|
||||
delay: 1000,
|
||||
login: {
|
||||
rememberMe: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}).providers,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
],
|
||||
exports: [
|
||||
NbAuthModule,
|
||||
],
|
||||
declarations: [],
|
||||
})
|
||||
export class CoreModule {
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
import { ExtraOptions, RouterModule, Routes } from '@angular/router';
|
||||
import { NgModule } from '@angular/core';
|
||||
import {
|
||||
NgaAuthComponent,
|
||||
NgaLoginComponent,
|
||||
NgaLogoutComponent,
|
||||
NgaRegisterComponent,
|
||||
NgaRequestPasswordComponent,
|
||||
NgaResetPasswordComponent
|
||||
} from '@akveo/nga-auth';
|
||||
NbAuthComponent,
|
||||
NbLoginComponent,
|
||||
NbLogoutComponent,
|
||||
NbRegisterComponent,
|
||||
NbRequestPasswordComponent,
|
||||
NbResetPasswordComponent,
|
||||
} from '@nebular/auth';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: 'pages', loadChildren: 'app/pages/pages.module#PagesModule' },
|
||||
{
|
||||
path: 'auth',
|
||||
component: NgaAuthComponent,
|
||||
component: NbAuthComponent,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: NgaLoginComponent,
|
||||
component: NbLoginComponent,
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
component: NgaLoginComponent,
|
||||
component: NbLoginComponent,
|
||||
},
|
||||
{
|
||||
path: 'register',
|
||||
component: NgaRegisterComponent,
|
||||
component: NbRegisterComponent,
|
||||
},
|
||||
{
|
||||
path: 'logout',
|
||||
component: NgaLogoutComponent,
|
||||
component: NbLogoutComponent,
|
||||
},
|
||||
{
|
||||
path: 'request-password',
|
||||
component: NgaRequestPasswordComponent,
|
||||
component: NbRequestPasswordComponent,
|
||||
},
|
||||
{
|
||||
path: 'reset-password',
|
||||
component: NgaResetPasswordComponent,
|
||||
component: NbResetPasswordComponent,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { BrowserModule } from '@angular/platform-browser';
|
|||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { NgaAuthModule, NgaDummyAuthProvider } from '@akveo/nga-auth';
|
||||
import { CoreModule } from './@core/core.module';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
|
|
@ -25,20 +24,6 @@ import { ThemeModule } from './@theme/theme.module';
|
|||
CoreModule,
|
||||
ThemeModule.forRoot(),
|
||||
CoreModule.forRoot(),
|
||||
NgaAuthModule,
|
||||
NgaAuthModule.forRoot({
|
||||
providers: {
|
||||
email: {
|
||||
service: NgaDummyAuthProvider,
|
||||
config: {
|
||||
delay: 1000,
|
||||
login: {
|
||||
rememberMe: true,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}),
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
providers: [
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ export const MENU_ITEMS: List<NbMenuItem> = List([{
|
|||
}, {
|
||||
title: 'Auth',
|
||||
icon: 'ion-unlocked',
|
||||
children: List<NgaMenuItem>([{
|
||||
children: List<NbMenuItem>([{
|
||||
title: 'Login',
|
||||
link: '/auth/login',
|
||||
}, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue