-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: save Address Doctor configuration to the state management so it …
…works with SSR (#1622) * save Address Doctor configuration in the ngrx store/address-doctor-store.module.ts * so the configuration can be provided in the docker_compose or in a deployment yaml file and be transfered from SSR to client side in the browser
- Loading branch information
Showing
13 changed files
with
356 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/app/extensions/address-doctor/store/address-doctor-store.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { EffectsModule } from '@ngrx/effects'; | ||
import { ActionReducerMap, StoreModule } from '@ngrx/store'; | ||
import { pick } from 'lodash-es'; | ||
|
||
import { AddressDoctorState } from './address-doctor-store'; | ||
import { AddressDoctorEffects } from './address-doctor/address-doctor.effects'; | ||
import { addressDoctorReducer } from './address-doctor/address-doctor.reducer'; | ||
|
||
const addressDoctorReducers: ActionReducerMap<AddressDoctorState> = { | ||
addressDoctorConfig: addressDoctorReducer, | ||
}; | ||
|
||
const addressDoctorEffects = [AddressDoctorEffects]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
EffectsModule.forFeature(addressDoctorEffects), | ||
StoreModule.forFeature('addressDoctor', addressDoctorReducers), | ||
], | ||
}) | ||
export class AddressDoctorStoreModule { | ||
static forTesting(...reducers: (keyof ActionReducerMap<AddressDoctorState>)[]) { | ||
return StoreModule.forFeature('addressDoctor', pick(addressDoctorReducers, reducers)); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/app/extensions/address-doctor/store/address-doctor-store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createFeatureSelector } from '@ngrx/store'; | ||
|
||
import { AddressDoctorConfig } from '../models/address-doctor/address-doctor-config.model'; | ||
|
||
export interface AddressDoctorState { | ||
addressDoctorConfig: AddressDoctorConfig; | ||
} | ||
|
||
export const getAddressDoctorState = createFeatureSelector<AddressDoctorState>('addressDoctor'); |
13 changes: 13 additions & 0 deletions
13
src/app/extensions/address-doctor/store/address-doctor/address-doctor.actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { createActionGroup, emptyProps } from '@ngrx/store'; | ||
|
||
import { payload } from 'ish-core/utils/ngrx-creators'; | ||
|
||
import { AddressDoctorConfig } from '../../models/address-doctor/address-doctor-config.model'; | ||
|
||
export const addressDoctorInternalActions = createActionGroup({ | ||
source: 'Address Doctor Internal', | ||
events: { | ||
'Load Address Doctor Config': emptyProps(), | ||
'Set Address Doctor Config': payload<{ config: AddressDoctorConfig }>(), | ||
}, | ||
}); |
Oops, something went wrong.