Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit c900319

Browse files
committed
🔧 configuration des elements du store NgRx
1 parent dd58cb7 commit c900319

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

src/app/app.module.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { StoreRouterConnectingModule } from '@ngrx/router-store';
1111
import { environment } from '../environments/environment';
1212
import { AppRoutingModule } from './core/routes/app-routing.module';
1313
import { AppComponent } from './core/components/app/app.component';
14+
import { ROOT_REDUCERS } from './core/store/app.store';
15+
import { ROOT_EFFECTS } from './core/store/app.effects';
1416

1517
@NgModule({
1618
declarations: [
@@ -20,11 +22,11 @@ import { AppComponent } from './core/components/app/app.component';
2022
AppRoutingModule,
2123
BrowserAnimationsModule,
2224
BrowserModule,
23-
EffectsModule.forRoot([]),
25+
EffectsModule.forRoot(ROOT_EFFECTS),
2426
FormsModule,
2527
HttpClientModule,
2628
ReactiveFormsModule,
27-
StoreModule.forRoot({}, {}),
29+
StoreModule.forRoot(ROOT_REDUCERS),
2830
StoreDevtoolsModule.instrument({ maxAge: 25, logOnly: environment.production }),
2931
StoreRouterConnectingModule.forRoot(),
3032
],

src/app/core/store/app.effects.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const ROOT_EFFECTS: any[] = [];

src/app/core/store/app.store.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { routerReducer, RouterState } from '@ngrx/router-store';
2+
import { Action, ActionReducerMap } from '@ngrx/store';
3+
4+
export interface AppState {
5+
router: RouterState;
6+
}
7+
8+
export const ROOT_REDUCERS: ActionReducerMap<AppState, Action> = {
9+
router: routerReducer,
10+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { getSelectors } from '@ngrx/router-store';
2+
3+
export const { selectRouteParams } = getSelectors();

0 commit comments

Comments
 (0)