Commit a4b31817 authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

feat: add admin and profile as lazy loaded modules

parent c54587c3
Pipeline #14217 passed with stages
in 6 minutes and 15 seconds
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PanelComponent } from './components/panel/panel.component';
const routes: Routes = [
{
path: '',
component: PanelComponent,
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AdminRoutingModule {}
......@@ -4,11 +4,11 @@ import { PanelComponent } from './components/panel/panel.component';
import { ClaimStructureComponent } from './components/claim-structure/claim-structure.component';
import { DeleteUserComponent } from './components/delete-user/delete-user.component';
import { SharedModule } from '../shared/shared.module';
import { NewsComponent } from '../post/news.component';
import { NewsletterUsersComponent } from './components/newsletter-users/newsletter-users.component';
import { AdminRoutingModule } from './admin-routing.module';
@NgModule({
declarations: [PanelComponent, ClaimStructureComponent, DeleteUserComponent, NewsletterUsersComponent],
imports: [CommonModule, SharedModule],
imports: [CommonModule, AdminRoutingModule, SharedModule],
})
export class AdminModule {}
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AboutComponent } from './about/about.component';
import { PanelComponent } from './admin/components/panel/panel.component';
import { FormComponent } from './form/form.component';
import { AdminGuard } from './guards/admin.guard';
import { AuthGuard } from './guards/auth.guard';
import { DeactivateGuard } from './guards/deactivate.guard';
import { CartoComponent } from './carto/carto.component';
import { LegalNoticeComponent } from './legal-notice/legal-notice.component';
import { ProfileComponent } from './profile/profile.component';
import { ResetEmailComponent } from './reset-email/reset-email.component';
import { ResetPasswordComponent } from './reset-password/reset-password.component';
import { TempUserResolver } from './resolvers/temp-user.resolver';
......@@ -59,7 +57,7 @@ const routes: Routes = [
{
path: 'profile',
canActivate: [AuthGuard],
component: ProfileComponent,
loadChildren: () => import('./profile/profile.module').then((m) => m.ProfileModule),
},
{
path: 'join',
......@@ -70,11 +68,6 @@ const routes: Routes = [
path: 'reset-password',
component: ResetPasswordComponent,
},
{
path: 'admin',
canActivate: [AdminGuard],
component: PanelComponent,
},
{
path: 'create-structure',
component: FormComponent,
......@@ -94,6 +87,11 @@ const routes: Routes = [
path: 'news',
loadChildren: () => import('./post/post.module').then((m) => m.PostModule),
},
{
path: 'admin',
canActivate: [AdminGuard],
loadChildren: () => import('./admin/admin.module').then((m) => m.AdminModule),
},
{
path: 'home',
redirectTo: 'news',
......
......@@ -57,7 +57,7 @@ import { NewsletterSubscriptionComponent } from './newsletter-subscription/newsl
StructureJoinComponent,
NewsletterSubscriptionComponent,
],
imports: [BrowserModule, HttpClientModule, AppRoutingModule, SharedModule, MapModule, ProfileModule, AdminModule],
imports: [BrowserModule, HttpClientModule, AppRoutingModule, SharedModule, MapModule],
providers: [
{ provide: LOCALE_ID, useValue: 'fr' },
{ provide: HTTP_INTERCEPTORS, useClass: CustomHttpInterceptor, multi: true },
......
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ProfileComponent } from './profile.component';
const routes: Routes = [
{
path: '',
component: ProfileComponent,
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ProfileRoutingModule {}
......@@ -2,11 +2,10 @@ import { NgModule } from '@angular/core';
import { ProfileComponent } from './profile.component';
import { SharedModule } from '../shared/shared.module';
import { CommonModule } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { ProfileRoutingModule } from './profile-routing.module';
@NgModule({
imports: [CommonModule, BrowserModule, SharedModule],
declarations: [ProfileComponent],
exports: [ProfileComponent],
imports: [CommonModule, ProfileRoutingModule, SharedModule],
})
export class ProfileModule {}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment