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