From af566e4026654fe981e3c60824b628d432ce3589 Mon Sep 17 00:00:00 2001 From: Kim Tran Date: Fri, 16 Feb 2024 10:46:24 +0100 Subject: [PATCH] Update update-guide.md shorten example --- update-guide.md | 83 +++++++------------------------------------------ 1 file changed, 11 insertions(+), 72 deletions(-) diff --git a/update-guide.md b/update-guide.md index 5ca774db..3a994346 100644 --- a/update-guide.md +++ b/update-guide.md @@ -30,94 +30,33 @@ npm i @onecx/keycloak-auth - because of an issue in NgRx, we need to use a workaround to correctly provide it in the app - your ...remote.module.ts should look like this for example: ``` -import { HttpClient } from '@angular/common/http'; -import { isDevMode, NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; -import { EffectsModule } from '@ngrx/effects'; -import { StoreRouterConnectingModule } from '@ngrx/router-store'; -import { StoreModule } from '@ngrx/store'; -import { StoreDevtoolsModule } from '@ngrx/store-devtools'; -import { - MissingTranslationHandler, - TranslateLoader, - TranslateModule, -} from '@ngx-translate/core'; -import { - addInitializeModuleGuard, - AppStateService, - ConfigurationService, - createTranslateLoader, - PortalApiConfiguration, - PortalCoreModule, - PortalMissingTranslationHandler, -} from '@onecx/portal-integration-angular'; -import { environment } from 'src/environments/environment'; -import { routes } from './app-routing.module'; -import { commonImports } from './app.module'; -import { metaReducers, reducers } from './app.reducers'; -import { Configuration } from './shared/generated'; -import { SharedModule } from './shared/shared.module'; - -export function apiConfigProvider( - configService: ConfigurationService, - appStateService: AppStateService -) { - return new PortalApiConfiguration( - Configuration, - environment.API_BASE_PATH, - configService, - appStateService - ); -} +// ... your imports +import { Actions, EffectSources, EffectsRunner } from '@ngrx/effects'; // Workaround for the following issue: // https://github.com/ngrx/platform/issues/3700 -import { Actions, EffectSources, EffectsRunner } from '@ngrx/effects'; - const effectProvidersForWorkaround = [EffectsRunner, EffectSources, Actions]; effectProvidersForWorkaround.forEach((p) => (p.ɵprov.providedIn = null)); @NgModule({ imports: [ - ...commonImports, - PortalCoreModule.forMicroFrontend(), - RouterModule.forChild(addInitializeModuleGuard(routes)), - TranslateModule.forRoot({ - extend: true, - isolate: false, - loader: { - provide: TranslateLoader, - useFactory: createTranslateLoader, - deps: [HttpClient, AppStateService], - }, - missingTranslationHandler: { - provide: MissingTranslationHandler, - useClass: PortalMissingTranslationHandler, - }, - }), - SharedModule, - // import necessary ngrx modules + // ... your other angular imports + StoreModule.forRoot(reducers, { metaReducers }), EffectsModule.forRoot(effectProvidersForWorkaround), StoreRouterConnectingModule.forRoot(), StoreDevtoolsModule.instrument({ - maxAge: 25, // Retains last 25 states - logOnly: !isDevMode(), // Restrict extension to log-only mode - autoPause: true, // Pauses recording actions and state changes when the extension window is not open - trace: false, // If set to true, will include stack trace for every dispatched action, so you can see it in trace tab jumping directly to that part of code - traceLimit: 75, // maximum stack trace frames to be stored (in case trace option was provided as true) + maxAge: 25, + logOnly: !isDevMode(), + autoPause: true, + trace: false, + traceLimit: 75, }), ], exports: [], - providers: [ - { - provide: Configuration, - useFactory: apiConfigProvider, - deps: [ConfigurationService, AppStateService], - }, - ], + providers: [], }) -export class ConstrTaskMgmtModule {} +export class YourModule {} ``` ## config key constants