Skip to content

Commit

Permalink
Update update-guide.md shorten example
Browse files Browse the repository at this point in the history
  • Loading branch information
KimFFVII authored Feb 16, 2024
1 parent 8de068a commit af566e4
Showing 1 changed file with 11 additions and 72 deletions.
83 changes: 11 additions & 72 deletions update-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit af566e4

Please sign in to comment.