Browse Source

Refactoring

pull/5906/head
David Requeno 2 months ago
parent
commit
41cc1e168f
  1. 28
      apps/client/src/app/app.routes.ts
  2. 21
      apps/client/src/main.ts

28
apps/client/src/app/app-routing.module.ts → apps/client/src/app/app.routes.ts

@ -1,13 +1,10 @@
import { publicRoutes, internalRoutes } from '@ghostfolio/common/routes/routes'; import { publicRoutes, internalRoutes } from '@ghostfolio/common/routes/routes';
import { NgModule } from '@angular/core'; import { Routes } from '@angular/router';
import { RouterModule, Routes, TitleStrategy } from '@angular/router';
import { AuthGuard } from './core/auth.guard'; import { AuthGuard } from './core/auth.guard';
import { ModulePreloadService } from './core/module-preload.service';
import { PageTitleStrategy } from './services/page-title.strategy';
const routes: Routes = [ export const routes: Routes = [
{ {
path: publicRoutes.about.path, path: publicRoutes.about.path,
loadChildren: () => loadChildren: () =>
@ -147,24 +144,3 @@ const routes: Routes = [
pathMatch: 'full' pathMatch: 'full'
} }
]; ];
@NgModule({
imports: [
RouterModule.forRoot(
routes,
// Preload all lazy loaded modules with the attribute preload === true
{
anchorScrolling: 'enabled',
// enableTracing: true, // <-- debugging purposes only
preloadingStrategy: ModulePreloadService,
scrollPositionRestoration: 'top'
}
)
],
providers: [
ModulePreloadService,
{ provide: TitleStrategy, useClass: PageTitleStrategy }
],
exports: [RouterModule]
})
export class AppRoutingModule {}

21
apps/client/src/main.ts

@ -9,7 +9,6 @@ import {
} from '@angular/common/http'; } from '@angular/common/http';
import { enableProdMode, importProvidersFrom, LOCALE_ID } from '@angular/core'; import { enableProdMode, importProvidersFrom, LOCALE_ID } from '@angular/core';
import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatChipsModule } from '@angular/material/chips';
import { import {
DateAdapter, DateAdapter,
MAT_DATE_FORMATS, MAT_DATE_FORMATS,
@ -19,7 +18,8 @@ import {
import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTooltipModule } from '@angular/material/tooltip'; import { MatTooltipModule } from '@angular/material/tooltip';
import { bootstrapApplication } from '@angular/platform-browser'; import { bootstrapApplication } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { provideAnimations } from '@angular/platform-browser/animations';
import { RouterModule, TitleStrategy } from '@angular/router';
import { ServiceWorkerModule } from '@angular/service-worker'; import { ServiceWorkerModule } from '@angular/service-worker';
import { provideIonicAngular } from '@ionic/angular/standalone'; import { provideIonicAngular } from '@ionic/angular/standalone';
import { provideMarkdown } from 'ngx-markdown'; import { provideMarkdown } from 'ngx-markdown';
@ -28,12 +28,14 @@ import { NgxStripeModule, STRIPE_PUBLISHABLE_KEY } from 'ngx-stripe';
import { CustomDateAdapter } from './app/adapter/custom-date-adapter'; import { CustomDateAdapter } from './app/adapter/custom-date-adapter';
import { DateFormats } from './app/adapter/date-formats'; import { DateFormats } from './app/adapter/date-formats';
import { AppRoutingModule } from './app/app-routing.module';
import { GfAppComponent } from './app/app.component'; import { GfAppComponent } from './app/app.component';
import { routes } from './app/app.routes';
import { authInterceptorProviders } from './app/core/auth.interceptor'; import { authInterceptorProviders } from './app/core/auth.interceptor';
import { httpResponseInterceptorProviders } from './app/core/http-response.interceptor'; import { httpResponseInterceptorProviders } from './app/core/http-response.interceptor';
import { LanguageService } from './app/core/language.service'; import { LanguageService } from './app/core/language.service';
import { ModulePreloadService } from './app/core/module-preload.service';
import { GfNotificationModule } from './app/core/notification/notification.module'; import { GfNotificationModule } from './app/core/notification/notification.module';
import { PageTitleStrategy } from './app/services/page-title.strategy';
import { environment } from './environments/environment'; import { environment } from './environments/environment';
(async () => { (async () => {
@ -77,11 +79,13 @@ import { environment } from './environments/environment';
useFactory: () => environment.stripePublicKey useFactory: () => environment.stripePublicKey
}, },
importProvidersFrom( importProvidersFrom(
AppRoutingModule, RouterModule.forRoot(routes, {
BrowserAnimationsModule, anchorScrolling: 'enabled',
preloadingStrategy: ModulePreloadService,
scrollPositionRestoration: 'top'
}),
GfNotificationModule, GfNotificationModule,
MatAutocompleteModule, MatAutocompleteModule,
MatChipsModule,
MatNativeDateModule, MatNativeDateModule,
MatSnackBarModule, MatSnackBarModule,
MatTooltipModule, MatTooltipModule,
@ -90,7 +94,10 @@ import { environment } from './environments/environment';
enabled: environment.production, enabled: environment.production,
registrationStrategy: 'registerImmediately' registrationStrategy: 'registerImmediately'
}) })
) ),
provideAnimations(),
ModulePreloadService,
{ provide: TitleStrategy, useClass: PageTitleStrategy }
] ]
}); });
})(); })();

Loading…
Cancel
Save